I have a number of solutions which share the same projects in different folders, for example,
Common folder
- common 1
- common 2
Contracts folder
- contracts for project A
- contracts for Project B
Application 1 folder (in this folder I have my solution file)
- Solution A
- nuget creates packages folder there
Application 2 folder
- Solution B
- nuget creates packages folder there
packages folder( I need this folder at top level, so all projects can reference it)
With this structure Nuget creates two packages folder inside of Application 1 and Application 2
But all of this projects and solutions related to each other, so logically it's better to have only one packages folder.
Is it possible to set in nuget only one folder and use that folder for all solutions?
Or should I structure my solutions and projects another way?
You can do this by adding nuget.config files to each solution with following contents
<settings>
<repositoryPath>..\Packages</repositoryPath>
</settings>
Make sure that they all point to the same folder.
When you make this file, you have to restart Visual Studio to make it use this setting ( or at least close and open the solution).
But more practical would be to create just one nuget.config that all solutions make use of. Just make sure it resides on a folder higher then any solution file you wish to include. When restoring, the nuget manager searches for this file, starting from next to the solution file and if not found, start looking higher up the folder structure.
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