Nuget packages folder one level up

nuget logoWe 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.

About erictummers

My work as a recruited developer changes almost every month. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s