How to make sure all projects in a Visual Studio 2013 solution have the same version of NuGet packages?
I created a Visual Studio 2013 solution with an MVC project and a class project, both created around the same time. The MVC project had a few NuGet packages pre-installed and I added some of them to the class project as well.
After many mysterious problems, and some tearing of my hair, I realized that my projects were given different versions of the same NuGet packages. This is related to the fact that the latest default MVC projects per default are referencing NuGet packages that today are in pre-release state, and my NuGet is set to not include pre-release packages. Running the NuGet package update will therefore not solve this issue.
How can you see what versions being used in each project? Each project has a file called
packages.config where information about all your NuGet installed packages can be found. As an example, while my MVC project got
Entity Framework 6.1.0-alpha1 the class project got
Entity Framework 6.0.2.
So the big question – how can I make sure that the projects in my solution all have the same version of the NuGet packages used?
It’s actually quite simple. In Visual Studio 2013 you can right click the solution, in Solution Explorer, and select
Manage NuGet packages for solution. In the window that opens up you can view all NuGet packages being used in all your projects. In the example below you can see that
Microsoft.AspNet.Identity.Core is used both as standard version as well as pre-release version.
Next to each version you have a
Manage button. When you click on that button you’ll see all available projects in your solution and you can from here force them to start using the version you’re currently managing, as illustrated in this picture below.
The answer to the question is basically to go through this list and make sure no NuGet packages are listed twice. If they are, you might have to solve that issue.