How to update nuget packages in many solutions at once
I have a repository with many solutions. Sometimes I need to upgrade one package to a newer version. This is a way to slow down each solution opening and updating through visual studio.
What's the best way to upgrade one package to a newer version for many solutions in the same git repository all at once?
source to share
You cannot do this with NuGet as it relies on Visual Studio as you can see here .
However, you have a NuGet alternative called Paket that works from the command line.
With Paket, you can manage packages across your entire repository globally (or by catalog) or create a package to update the package for each solution.
Managing packages globally or by catalog means that you must have the same version of packages in all solutions or in all solutions under the paket directory.
source to share
What I did was just find the version numbers that need to be updated with sublime. This solution is risky, but the only one I found.
- I have updated links in solution files and version numbers in package.config files.
For example: EntityFramework version 4.3.0 to version 6.0.0
-
Update solution files Find with regex:
<Reference Include="EntityFramework((?s).*?)</Reference>
Where:*.csproj
Replace with:<Reference Include=\"EntityFramework, Version=6.0.0.0\">\n\t\t<HintPath>$\(SolutionDir\)\\packages\\EntityFramework.6.0.0\\lib\\net45\\EntityFramework.dll<\/HintPath>\n\t<\/Reference>
-
Update package files Find with regex:
<package id="EntityFramework" version="((?s).*?)" targetFramework="net45" />
Where:packages.config
Replace with:<package id="EntityFramework" version="6.0.0" targetFramework="net45" />
source to share