What is the proper technique for keeping NuGet packages in sync across multiple shared projects and solutions within Visual Studio? We share 200+ projects across multiple solutions. Each TRACK has a handful of solutions which have some or all of the track's projects. We also have several PLATFORM solutions which pull in multiple tracks as well as any number of the track's projects. Unfortunately, we have a few vendors that REGULARLY push out updates to their packages and developers inadvertently install / update packages while working in different solutions. We need to ensure the packages are updated regardless of what solution uses them.
Unfortunately, NuGet's site discusses how to perform the actual update, but not how to synchronize everything... http://docs.nuget.org/docs/start-here/Managing-NuGet-Packages-Using-The-Dialog#Updating_a_Package
This isn't technically correct that you can't do this. You can use the built-in tools in Visual Studio 2010 / 2012 to do this for you.
In order to update packages in all the projects at the same time, you can launch the Manage NuGet Packages dialog at solution level.
So right-click the solution, then choose "Manage NuGet Packages for Solution". And presto! You're off and away!
Now, while it won't "sync" them automatically, it does allow you to see where you have duplicates and help you to move each of your projects to the proper versions of nuget packages you want to use.
Not a silver bullet, but it will help.
There's no really good way to do this unfortunately.. What we do is run our own NuGet repository. When we want to force an update of a package, we delete the old version entirely, and upload the new one.
This doesn't guarantee that the developers pull the latest package of course, so we've made it part of our CI process to automatically pull all the NuGet packages into the solution prior to building, so if some package is updated and the developers haven't caught up, their next commit will fail the CI build, forcing them to go fix it.
It's kind of a workaround, but it's the best we've been able to come up with..
It is possible to maintain all Nuget versions within a solution in a single .props file. However, this procedure requires some steps to be performed manually. I have seen this approach partially used in the dotnet/cli project on github:
Create a new file with the extension .props, for example: Versions.props
For each package in your solution (in all projects), create a property with the corresponding version (use of version ranges is possible)
<Project>
<PropertyGroup>
<log4netVersion>2.0.8</log4netVersion>
<UnityVersion>5.9.*</UnityVersion>
</PropertyGroup>
</Project>
<Import Project=".\version.props" />
<ItemGroup>
<PackageReference Include="Unity" Version="$(UnityVersion)" />
<PackageReference Include="log4net" Version="$(log4netVersion)" />
</ItemGroup>
As described above, this procedure musst be done manually. Installing nuget packages with the nuget package manager will overwrite the version properties!
dotnet restore
on the solution to update all packages and dotnet list package
to list all requested and resolved packages per project!If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With