We had some issues with our nuget server. Every other build would fail because of a failing nuget restore. We decided to stop restoring the nugets and put them in source control.
Adding the nugets will increase bytes in source control. We want to limit this by moving our packages folder one level up. This way all solutions will use the same packages folder for their nugets. No duplicates = less bytes.
The process is well explained in this answer on stackoverflow. In short:
- Edit the nuget.config to set a repositorypath to $\..\..\..\packages and disableSourceControlIntegration to false.
- Then edit the nuget.targets to set PackageDir as $(SolutionDir)\..\packages.
- Fix the references in the project files
We documented this and instructed the team to make the changes on every (new) solution. New solutions will not need to fix the references as new projects use the correct path to the nuget / packages folder.
The nuget server issue turned out to be a duplicate package. The packages had different names, but with identical nuspec information. After removing the duplicate everything was fine again.