How to ensure that all projects in a C # solution use the same versions of a third-party library?

I worked on a solution with several projects, and I updated Newtonsoft.Json in one of the projects (class library). This caused some errors in another project (ASP.Net WebApi project) because it also needs a link to Newtonsoft.Json for the update.

The error was launched at runtime without compilation, and I had to manually install Newtonsoft.Json for each of the projects as part of the solution.

 Install-Package Newtonsoft.Json 

This made me wonder if all third-party libraries can be updated at the solution level?

I know that you can create a folder for storing libraries and add it to the original control, but I would like to avoid this.

I want Nuget to load libraries after retrieving the solution from the repository. I was wondering if it is possible:

  • Create a new project in a solution called www.solution.com.thirdparty
  • Add a link to all third-party programs using nuget
  • Export all third-party libraries through www.solution.com.thirdparty

I don’t know how I can take the third step, and I also know if there is a better way to do this?

+6
source share
1 answer

Use packages at the solution level, as described in this post .

Alternatively, you can look at Paket , it has a good transitive dependency resolution algorithm that might work for you.

+8
source

All Articles