Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I was working on a solution with multiple projects and I updated Newtonsoft.Json in a one of the projects (a class library). This caused some errors in another project (an ASP.Net WebApi project) because it also needed the reference to Newtonsoft.Json to be updated.

The error was thrown at run-time not compile-time and I had to manually install Newtonsoft.Json on each of the projects within the solution.

Install-Package Newtonsoft.Json

This lead me to wonder if it is possible to update all third party libraries at solution level?

I know you can create a folder to store the libraries and add that to the source control but I would like to avoid that.

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

  1. Create a new project in the solution called something like www.solution.com.thirdparty
  2. Add reference to all third party software using nuget
  3. Expose the all third party libraries via www.solution.com.thirdparty

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

like image 480
Remo H. Jansen Avatar asked Oct 02 '15 10:10

Remo H. Jansen


1 Answers

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

Alternatively you can have a look at Paket, it has a nice transitive dependency resolution algorithm that may work for you.

like image 69
Luis Belloch Avatar answered Nov 10 '22 13:11

Luis Belloch