LinkedIn

Wednesday, 27 April 2016

Moving nuget package folder to a different location (1 level higher)

Hi,

Note: thanks to this post by sebastian belczyk for some help:
http://belczyk.com/2013/02/moving-nuget-packages-directory-outside-solutionss-directory/

This morning I need to relocate my nuget packages folder 1 level higher to allow an offshore team to work parallel with us. Basically, the original solution was cloaked and branched. In the original solution we realised we had 2 places for nuget packages so hence we had to merge them into 1 solution. This mean't that the branched solution need to match the original other wise we would have lots of reintegration issues.

Firstly, I needed to update my nuget.config file. We had our package located here:
../packages/
But we really needed them here:
../../packages/ - up another level.












Then I needed to close the solution and reopen it for this change to take affect. I found this out as changing the file without restarting meant that nothing changed and my packages were still restoring to the old ../packages/ directory.

Then right click to Manage nuget Packages for Solution ...


































Then Visual Studio will detect that there is no nuget packages folder on the file system at the location specified:














It will load them when you click restore:









So in summary, I had this file structure:
Soln
-- Project
---- packages Folder

And now I have this structure:
Soln
-- packages Folder
-- Project



thanks
Russ