Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating nuget packages in all projects in a solution

I have a .net solution (say A) with multiple projects(say B,C,D). I want to update all nuget packages for all projects in the solution. I know I can update nuget packages using command line but passing in the path to packages.config

nuget update A/B/packages.config 

Is there a way to update packages for all packages.configs inside folder A using command line without having to specify them individually? (I know this can be done from inside visual studio.) Something like

nuget update A/*/packages.config 
like image 542
KnightFox Avatar asked May 05 '14 16:05

KnightFox


People also ask

How do I refresh all NuGet packages?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

How often should you update NuGet packages?

2 Answers. Show activity on this post. Well, you should update whenever you are able to cope with it.


2 Answers

As found in NuGet documentation, you can type:

Update-Package 

This will :

Update all packages in all projects of the current solution to the latest versions.

To open the Package Manager Console:

Tools > NuGet Package Manager > Package Manager Console

Now, in order to have only one instance of all packages, I have, in my solution folder, a file named nuget.config that contains:

<configuration>   <config>     <add key="repositoryPath" value="..\Path\To\My\Packages" />   </config> </configuration> 

You might need to reload your solution in order to make it work properly.

like image 152
Maxime Avatar answered Sep 22 '22 23:09

Maxime


You have used command line examples, but your question does not state if you require a command line answer. If you do not require command line, you can right-click on your solution in the Solution Explorer, and select Manage NuGet Packages for Solution ... This displays a dialog where you can make your selections. Other than that, you'd need to write a script at this point in time anyway (as far as I know).

like image 27
clairestreb Avatar answered Sep 25 '22 23:09

clairestreb