I've got a Problem with Visual Studio 2010 and the Newtonsoft.Json library.
A few hours ago nothing was wrong with my project, but now it throws this error
The type or namespace name 'NewtonSoft "could not be found. (Missing a using directive or an assembly reference?)
--I just saw that the Reference was deleted and i can't re-add the NewtonSoft.Json library.
You can use the package manager console to remove the package, if you're having trouble getting NuGet to uninstall or reinstall it using the GUI:
Uninstall-Package Newtonsoft.Json
Be sure you've selected the right target project from the dropdown at the top of the console if your solution contains several projects.
Make sure that the .NET framework version your project targets is the same or higher than the one your Json.NET nuget package requires.
Related
I got an issue working with Nuget packages and local projects.
I am working on a .Net Framework solution, with many projects and many of them are packaged with Nuget in a private repository. I am using PackageReferences to resolve nuget packages. I am working on solution with that kind of dependency tree.
StartUpProject
Project1(LocalProject)
Project2 v1.0.0(NugetPackage)
Project3 v1.0.0(NugetPackage)
Project3 v1.0.1(LocalProject)
When I want to debug or upgrade functionality of packaged project, I remove Nuget package and add that assembly as local project.
When I am navigating in the source code if I try to go to some function from the modified project, Visual Studio open the code as external assembly and does not resolve like local project.
Maybe the problem is other Nuget package (Project2) depends from I removed Nuget package (Project3) and Visual Studio still resolving that assembly as Nuget package.
The error that Visual Studio throws at compilation is CS0433: The type 'MyType' exist in both'Project3 , Version=1.0.0, ...' and in 'Project3, Version=1.0.1, ...'
What is way to work in that cases?
Is any way to force to use local project than dependency nuget package?
Thank you!
I downloaded Newtonsoft.Json.11.0.2 package by package manager console,
and it certainly showed that the package is installed in project.
However, when I try to use the package
using Newtonsoft.Json
visual studio keeps warning me the name is not found and draws red underline.
What should I do? uninstalling and reinstalling the package didn't work.
Make sure you have selected same project while installing package
Add a reference by clicking on your project in the solution explorer with right click -> References -> Newtonsoft Json.
Add it and compile.
Had the same issue, i notice that i have some bll files that have been installed
Microsoft.AspNetCore.Mvc.NewtonsoftJson
Newtonsoft.Json
Newtonsoft.Json.b..
i removed all the files exept 'Newtonsoft.Json' closed the vs.code reopened it and it worked!
I have a solution with two projects - a primary project, and a unit test project. When opening in Visual Studio 2015 all references are found and project builds successfully. When opening in Visual Studio 2017 several but not all NuGet package references are not found and compile fails. Some of the failed references are...
System.Data.Common
System.Net.Http
System.Net.Http.WebRequest
System.Security.Cryptography.Algorithms
System.Security.Cryptography.Encoding
System.Security.Cryptography.Primitives
System.Security.Cryptography.X509Certificates
... but other NuGet references are found with no problem. This solution was created with VS2015. When viewing the .csproj file nothing out of the ordinary is jumping out.
I am thinking of rebuilding it from scratch in VS2017 to try to identify the problem.
Has anyone else experienced this problem, and/or has anyone any suggestions on why this is occurring and what should be done to facilitate a fix?
Update:
I created a brand new VS2017 WebApi project referencing .NET 4.7.1, and compiled successfully. I then added NuGet package System.Data.Common 4.3.0. The NuGet install process appears to have completed with no errors, but still I am left with an invalid reference. That was pretty easy to replicate.
OK, answering my own question.
I found what I believe is the answer. This particular project was originally developed in VS2015 using .NET 4.6.2. When changing to VS2017 we elected to upgrade .NET to 4.7.1. The problem is with the .NET version, not the VS version.
The newer version of .NET has many of these NuGet assemblies added to standard libraries. The NuGet packages were in conflict with the native .NET 4.7.1 namespaces. For example, in .NET 4.7.1, the namespace System.Data.Common is found in the assembly System.Data.dll. No longer is it required to add a NuGet assembly System.Data.Common.dll. In fact, if I do add System.Data.Common NuGet package assembly, I now have two assemblies having the namespace System.Data.Common - one in System.Data.dll and another in System.Data.Common.dll - hence the reference problem.
The solution is to use the .NET 4.7.1 version and remove the extra NuGet assembly. This was also true for System.Security conflicts. The conflict with System.Net.Http was actually moved into a NuGet assembly called Microsoft.AspNet.WebApi.Client.
I hope all of this helps someone else...(uhhhgggg)....
BTW - it appears that when using VS2015 with .NET 4.7.1, these conflicts are suppressed and never display. This feels like a shortcoming of VS2015. Glad VS2017 shows them to reveal the true problem...
Check your packages.config file to make sure the Nuget packages are actually listed as dependencies for your project.
Also, open the solution in VS 2015 and double check the file path for the references in question. Make sure the DLLs are not referenced from a file path unique to Visual Studio 2015.
I had to create a new project and transfer all the necessary files from the old project to new project to fix this.
I've been using the Firebird client since 1.5 and I'm now on 2.6 in my
Visual Studio 2010 project with .Net 4.0
In my VS2010 Project I removed the reference FirebirdSql.Data.FirebirdClient.dll v2.6
I've installed the Firebird client 5.12.1.0 and then added the FirebirdSql.Data.FirebirdClient.dll v5.12.1.0 to the solution.
When trying to build the project I now get and error
The type or namespace name 'FirebirdSql' could not be found (are you
missing a using directive or an assembly reference?)
on every
using FirebirdSql.Data.FirebirdClient;
I've restarted the Visual Studio and still get errors.
I can uninstall FirebirdSql.Data.FirebirdClient 5.12.1 and reinstall
FirebirdSql.Data.FirebirdClient 2.6 and (remove old reference and add new reference) the project compiles.
Any ideas why?
The reason why you cannot use the FirebirdClient 5.12.1 most likely is because your .NET-Version of 4.0 is not compatible. When trying to use the newest FirebirdClient you should also get a warning, stating that it was build with .NET-Version 4.5.2 and that you need to change the framework version of your project.
So, either install a newer .NET-Framework (4.5.2 or up) or continue to use the older FirebirdClient version 2.6.
EDIT: I found a better solution on Firebirds website: Use the NuGet-Package, install it by typing Install-Package FirebirdSql.Data.FirebirdClient into the packet-manager console and it will choose the correct package for you.
However, as stated in the comments, you'd need at least NuGet client version 3.6, which doesn't support Visual Studio 2010.
Symptoms
I've been attempting to fix my Xamarin forms solution in Visual Studio 2017 RC1 that was generated as a brand new template. While both the android and iOS sub solutions have all their .dll references properly referenced, my UWP (Universal Windows) sub solution seems to be missing essential references to the following .dll files:
'System'
'Xamarin'
'Application'
'Linq'
I was able to locate the .dll references for 'System' and 'System.Linq', in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework, but I'm having trouble locating the specific 'Xamarin' reference for UWP (Windows). I am fairly certain finding the 'Xamarin' reference will also resolve the 'Application' reference as I believe it is a derivative of 'Xamarin'.
Attempted fixes
1. Clean solution
Result: Clean immediately cancels, errors regenerate
2. Create new solution
Result: No change
3. Reinstall Visual Studio 2017 (Several times) and then create new solution
Result: No Change
Specific Error(s)
CS0246 The type or namespace name '-insert reference here-' could not be found (are you missing a using directive or an assembly reference?)
This is happening in project platform -solution name-.UWP in the App.xaml.cs file.
I had the same problem. Unloaded and reloaded the UWP project and suddenly all my lost nuget references appeared (Xamarin.Forms, Microsoft.NETCore.UniversalWindowsPlatform, sqlite-net-pcl, ...)
Turns out the Nuget package needed to be updated.
To do this, use the "Solution Explorer" Window, right click references -> Manage NuGet Packages. A new window will pop up allowing you to update and install NuGet packages.
Alternatively, you can navigate to the Package Manager with Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.
You can also use the package manager console and use the command: Update-Package to update all packages.