I have a simple console application that is supposed to use Newtonsoft.Json to desrialize JSON objects.
I installed Newtonsoft.Json via Manage Nuget for Solution and the package shows as installed in Nuget however the reference is not showing at all in the project or in the file .csproj.
Any clue?
Maybe you should add a reference to the library. Project->Add reference, find package you need and press ok. Then you can include this package to your project with keyword using.
Related
I want to save my level files to .json files in the Unity assets folder. Due to the limited features of JsonUtility I want to use Json.NET. I use Linux so I can't access Visual Studio and use Visual Studio Code instead. I wanted to add the package to my Unity project and took the guide from here
Install a Nuget package in Visual Studio Code
First I used this command in the terminal
dotnet add package Newtonsoft.Json
but I got this error
error: Error while adding package 'Newtonsoft.Json' to project
'/.../myUnityProject/Assembly-CSharp.csproj'. The project does not
support adding package references through the add package command.
After that I installed the Nuget extension and installed Newtonsoft.Json#12.0.2 to my project. I was prompted to run dotnet restore to be able to use the package.
After doing so I got this error
MSBUILD : error MSB1011: Specify which project or solution file to use
because this folder contains more than one project or solution file.
So what is the correct way to install third party tools using Visual Studio Code with Unity?
Unfortunately, due to Unity3D's heavy-handed manipulation of SLN files, it is not possible to use NuGet packages within a Unity project.
In the case of Newtonsoft.Json, it is available on the Asset Store for free, you can install from there.
Other packages can be used manually by downloading the .nupkg file from the NuGet website, extracting the DLLs for .NET 4.x, and placing them in your project's Assets folder.
If the library contains native code, you might not be able to use it on every platform, however. But if you get per-platform DLLs, you can set them up in the Unity editor to only be used for the correct platforms.
I built some protocal buffers using Protoc tools version 1.7.2 using the project I created from followed the tutorial here:
https://grpc.io/docs/quickstart/csharp.html#update-and-run-the-application
The code generated from the .proto file spat out this line:
new pbr::FileDescriptor[] { global::Google.Api.AnnotationsReflection.Descriptor, },
I have tried updating all the nuget dependencies to 1.8.0. Still missing this library. The term is too generic to find anything useful with a web search.
What do I need to include to get this working?
Install the package "Google.Api.Gax.Grpc".
From the Package Manager Console in Visual Studio select your project, then run:
Install-Package Google.Api.Gax.Grpc
Installing the nuget package "Google.Api.CommonProtos" works, I believe it's been removed from "Google.Api.Gax.Grpc"
I am developing a console application in C# which requires some dll file to be referenced in Visual Studio Code(not Visual Studio!). There is no such option in menu I guess and I even tried Nuget package manager, but it does not worked for me. I cannot find any tutorial regarding this. Any experienced user?
You can use dotnet-add reference CLI command which provides a convenient option to add project references to a project.
Example: Add a project reference:
dotnet add app/app.csproj reference lib/lib.csproj
For more information, refer this.
I'm using Visual Studio(VS) 2010 Ultimate (with .NET 4.0) to install Json.NET (10.0.2) but get failed with error message:
'Newtonsoft.Json' already has a dependency defined for
'Microsoft.CSharp'
I've tried to search solution for this and tried many ways like: update NuGet Package. but unfortunately, it didn't work.
What is to be done?
More tried update:
The version of NuGet Package: 2.8.60318.667
Install Json.net version: 9.0.1 without problem
I tried this solution and it worked for me:
Tool -> NuGet Packages Manager - Manage Nuget Package for Solution
Select Online tab and search online for Nuget.CommandLine -> install it
After installing, you can find nuget.exe in your Current Project folder -> Packages -> NuGet.CommandlineXXX
Run CMD and use command install to install latest version of Json.NET
Back to Project -> add reference - Browse for DLL file
Done!
Please check the version of .NET Framework you are using. There are chances that previous frameworks such as v3.5 or below doesn't support latest version of JSON.
Or this would help you : NuGet: 'X' already has a dependency defined for 'Y'
I have been using xamarin studio, it works fine when I download a sample project from mvvmcross. It compiles and deploys the device perfectly.
But when I open the project in the visual studio, there are a lot of missing packages for some reasons. Is there a way of handling ? I am using Nuget 2.8 in Visual studio 2013
When I open Nuget as follows, there is a button to restore the missing packages. I clicked on it.
Then it is attempting to download the missing packages, and then it realizes there are dependencies as follows:
Then I am attempting to download the dependency manually as follows but it shows the packages has already downloaded but I am still seeing the missing packages in the solution, nothing is affected.
Therefore I am getting hundreds of errors as follows:
When I take a look at the property of missing packages, I see as follows
You should update your NuGet Package Manager extension in Visual Studio and then try restoring the packages again.
The restore error MvvmCross.Binding already has a dependency defined for MvvmCross.Core is caused by an old version of the NuGet package manager extension not recognising the newer target frameworks that the MvvmCross.Binding NuGet package is using in its group dependencies. This bug has been fixed in a newer version of the NuGet Package Manager.
If you search for the 'already has a dependency defined' error message you will find several cases of this, such as this StackOverflow question, for example:
Can not install NuGet package
Right click on the solution in solution explorer and choose 'restore nuget packages'