Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Update is not working propelry

I want to update the Nuget packages used in the solution file and currently, I am using the following command to update the Nuget packages.

NuGet restore <projectPath> [options]

Reference: https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#restore

If no solution file, packages.config, or project.json is found, NuGet gives an error.

Reference: https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#remarks

But the problem is I am using the packages.ProjectName.Config instead of packages.config file.So the NuGet update is not properly working.

Note: Similarly if the folder contains multiple project and solution files the NuGet update is not working.

Please suggest how to overcome this issue?

Edit: Initially I thought the packages.[projectname].config usage in my source is the reason for NuGet packages restoring but later I found that NuGet packages are not even properly restored with packages.config files.

I have more than solution and project file in my source, After deleting the other projects, The NuGet restore is working properly in my source.

Is having more than one solution file is the reason for Nuget not updating? Anyone faced the problems , Any help to overcome this issue will be useful.

like image 865
Venkat Avatar asked Mar 22 '17 08:03

Venkat


People also ask

How do I refresh a NuGet package?

Restore packages manually using Visual StudioEnable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.

How do I update NuGet dependencies?

By Command-line: You can download nuget.exe,and add the path where it exists to Path system environment variables. Then you could simply reference the nuget.exe directly. After that you can use command like nuget update YourSolution. sln in Package Manager Console to update the dependencies for solution.


Video Answer


2 Answers

Nuget restore requires a Visual Studio solution file, a packages.config file or a project.json file.

See the remarks for it's beavior.

like image 142
devlead Avatar answered Dec 14 '22 00:12

devlead


Looks like you can't specify an arbitrary name but you should be able to accommodate your scenario as of NuGet 2.8. The project names just need to match the filenames - I don't imagine spaces are allowed.

NuGet release notes;

Individual packages.config Files for Different Platforms When developing applications for multiple target platforms, it is common to have different project files for each of the respective build environments. It is also common to consume different NuGet packages in different project files, as packages have varying levels of support for different platforms. NuGet 2.8 provides improved support for this scenario by creating different packages.config files for different platform-specific project files.

ReactiveUI packages.config files

Looks like ReactiveUI do this, so worth checking their repo;

ReactiveUI Github

like image 44
PaulB Avatar answered Dec 13 '22 23:12

PaulB