Thursday, 22 August 2013

Setting up a common nuget packages folder for all sulutions when some projects are included in multiple solutions

Setting up a common nuget packages folder for all sulutions when some
projects are included in multiple solutions

I have been using NuGet to retrieve packages from external and internal
package sources, which is very convenient. But I have realized that the
packages are by default stored per solution, which is very frustrating
when some projects with NuGet references are included in several
solutions. Then the references are changed to other solutions package
folder which may actually be unavailable to another developer or build
machine.
I have seen that there are ways to point out a common package location
(perhaps at the project root level, we are using TFS source control) with
the release 2.1 of NuGet. release notes
But I have tried to add nuget.config files without seeing any effect of
this. Is there anything I have missed? Ther seems to be different
structures of the xml node to add:
<settings>
<repositoryPath>..\..\[relative or absolute path]</repositoryPath>
</settings>
or
<configuration>
<config>
<add key="repositoryPath" value="..\..\[relative or absolute path]" />
</config>
</configuration>
I don't know which one of these, or any, or both will work in the end. I
have tried both at solution level. Do I need to remove all installed
packages before those references will work? I would love if someone could
provide a step-by-step instruction for moving from solution-specific nuget
usage to a common package folder where projects that belong to several
solutions can find their required nuget packages.
Thanks for any help in advance.

No comments:

Post a Comment