Is the "one project used in multiple solutions" issue still without a resolution?

Topics: General
Jan 22, 2015 at 5:03 PM
We recently found ourselves with this problem (when building SolutionA, ProjectA is looking in the folder path for SolutionB\packages because it's also used in SolutionB, for it's nuget references and SolutionB\packages doesn't exist in the build context).

I had thought that maybe the switch from "Enable Package Restore" to "Automatic Package Restore" would help with this problem but as far as I can tell there is no change.

I've done a lot of searching, but the vast majority of discussion of this issue deals with people from months/years back who were discussing the problem from the standpoint of using nuget before the "Enable Package Restore" option was introduced or before it became the suggested practice to abandon "Enable Package Restore" in favor for "Automatic Package Restore" so many of their suggestions or workarounds don't apply.

It seems like for our situation if we could have a global Packages folder that might solve our problem, but I'm clear if that is even an option and if so how to pull it off.

I'm hoping anyone can give me some direction :(
Jan 22, 2015 at 9:33 PM
Did you try using the repositoryPath setting in the NuGet.Config file? That setting allows you to override the default packages folder on a per solution basis or even globally. After adding the NuGet.Config file and configuring the path you would need to reinstall the packages in the projects so they have the correct hint paths.
Jan 23, 2015 at 2:03 AM
This is exactly what I am experimenting with at the moment and it seems like it might work. It believe I can force my solutions to go back to using the "wrong" way (Enable Package restore, add the nuget.targets and nuget.config files back) and use a common packages folder for everything, but as I pointed out, people were saying this was the incorrect (old/deprecated/obsolete) way to restore packages and so I felt like maybe there was some obvious solution to my dilemma using the new Automatic Package Restore.

I didn't realize you could have the repo path be set globally. That might help with our build servers. Thanks.
Jan 26, 2015 at 10:17 PM
A NuGet.Config file will be used by the new Automatic Package Restore for package sources and optionally the repositoryPath setting if it is found. It does not use a NuGet.targets file to do the restore. So you would not need to use the deprecated "Enable package restore" which adds the NuGet.targets file to your project.