I have a project in .Net Standard an it uses several Nugets. for example Newtonsoft.Json. When I want to use this dll in another project, some errors occur and it says Unable to resolve dependencies.
I want to embed nuget into my project. What should I do?
Clear the NuGet cache files. You do this in the following way:
In the toolbar of Visual Studio, navigate to Tools » NuGet Package
Manager » Package Manager Settings.
In the left pane, navigate to NuGet Package Manager » General. Click
Clear All NuGet Cache(s).
To do this, navigate to Tools » NuGet Package Manager » Package Manager Settings » Package Sources.
Delete all packages from the packages folder, located in your project's folder.
Reinstall Newtonsoft.Json to the desired version. Rebuild the project.
Depending on the project and the underlying framework, some versions of .NET do not support .NET Standard. You should check the versions of your project and the .NET Standard NuGet you're trying to reference.
Here you could find data (from Microsoft) on the current support status for .NET Standard.
Related
I have been working maven projects since 2 two years.First of all, I import maven projects to eclipse then
thanks to my pom.xml some dependencies is installed and I see these dependencies on my maven dependencies folder on eclipe project explorer.It connected to my .M2 folder.
Right now , I import a .Net framework project (which is written with C#) in my visual studio program.The solution explorer (references section) show many dependencies(they gives error).Then I found these libraries then I created a folder which is called nugetPackages and I connected my nuget packages manager to that folder(tools/options/nuget package manager/package sources).I reopen my project and libraries on references section does not give any error.My question is where does that libraries names come from ? There are any file like that pom.xml.
I hope I can explain my situation.
Are the libraries (DLLs) that you want to reference in your project NuGet packages or just some framework libraries? If they are Nuget packages they should be described in packages.config file http://prntscr.com/1140xn0 for the classic .NET application (.net framework 4.5 for example) In a .Net Core applications the Nuget packages that are required are defined in the file .csproj file http://prntscr.com/11412iq. In both cases, you can download all required NuGet packages by right clicking on the .sln file and selecting Restore Nuget Packages http://prntscr.com/1140zsk This will automatically create the nugget folder and download all required Nuget packages. If you have manually added dlls you need to navigate to them and select them by right-clicking References - Add reference http://prntscr.com/114142x
We have a solution with two projects (both version .net 4.6.2).
When installing a nuget package from our private Nuget Feed to either one of the projects, it works.
If we try to install the same package version into both projects, then package gets installed into one of them, and the other one gives error : "Error Could not install package 'OurInternalPackageName 1.0.1.5'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. ".
We tried installing nuget using 'Manage packages for solution' option, manage nuget packages for projects separately but the result is still the same.
Changing .NET framework versions does not help.
Clearing Nuget cache did not help as well.
The workaround we are using now: install package to one of the projects, and then install a lower version of a package to another project.
We tested this with 'Automapper' Nuget, tried to install into both projects and it worked (Same version got installed into both projects).
Any ideas would be appreciated.
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've got a class library that till today was for .NET 4.5, now I've been asked to port it to .NET 40 but I've got some difficulies. I've followed this approach
and it works for the nuget packages that
but using this approach I get an error when going to Manage Nuget Packages telling
What's the most clean way to target different .NET framework version without loosing nuget package manager?
UPDATE #1
I've this version of nuget package manager
The error message caused by the duplicate packages listed in packages.config file. Because the Manager NuGet Packages window will read the packages.config file to list installed packages in your project and manage them.
For your situation, please check whether the packages in your project could compatible with both of .NET 4.5 and .NET 4.0. If yes, you need not to use two version packages in one project. You just need to change the project .NET Framework through Project -> Properties -> Application -> Target Framework.
If the installed packages version could not compatible with .NET 4.5 and .NET 4.0 at the same time, and you still want to use the Manager NuGet Packages, I suggest you do with below manual operation: Comment out one version of the packages in packages.config file and then open Manager NuGet Packages. After using Manager NuGet Packages, please uncomment the version that commented before.
I want to read a doc file and do some operation and I found a code, but it has asking following "WordprocessingDocument" namespace.Has anyone know from where I can find this assembly.please dont sent me a download link for .dll file because it not good to add third party .dll directly.
you can download "Open XML SDK 2.5 for Microsoft Office" from http://www.microsoft.com/en-us/download/details.aspx?id=30425
for using this lib go to http://msdn.microsoft.com/en-us/library/office/bb448854.aspx
As per recent updates and methods for adding any namespaces related to Open XML SDK please add name spaces like System.IO.Packaging, DocumentFormat.OpenXml etc via Nuget Package. You can find nuget package on https://www.nuget.org/packages/DocumentFormat.OpenXml/
To Install this Nuget Package you can open Nuget Package Mananger console (Tools -> Nuget Package Manager -> Nuget Package Manager Console) and make sure that you have right project selected in console dropdown.
Run the following command.
Install-Package DocumentFormat.OpenXml
Alternatively you can also install it via Nuget Package Manager GUI which you can open simply by Right clicking on Solution Explorer and going in 'Manage Nuget Packages'