How to specify the location of nuget packages when enabling package recovery?

I am working on a .net solution and am using nuget to manage packages. I chose the option "Enable Nuget package recovery" so that nuget packages are not checked for source control.

Before that, I had the nuget.config file at the same level as the solution in which I included the following to indicate the location of the nuget packages.

<settings> <repositoryPath>..\Build\NuGetPackages\</repositoryPath> </settings> 

Since I turned on nuget package recovery, this no longer works. I tried updating the configuration file in the .nuget generated folder, but this does not work either.

So where am I mistaken and how can I specify the location of the package folder?

+4
source share
3 answers

You can change the following property in the file your-solution\.nuget\NuGet.targets :

 <PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir> 

Or the same property, but in the group below if you use Mono.

+2
source

When you enable nuget package recovery, there is a NuGet.Config file in the .nuget folder.

Here is a copy showing the path to my libs folder. You can change yours to fit your path. I think it is a little cleaner than the answer already selected.

 <?xml version="1.0" encoding="utf-8"?> <configuration> <solution> <add key="disableSourceControlIntegration" value="true" /> </solution> <config> <add key="repositoryPath" value="../../libs/packages" /> </config> </configuration> 
+4
source

You can also see nuget 2.1 release notes here http://docs.nuget.org/docs/release-notes/nuget-2.1 , where there is a new parameter added to nuget.config to indicate the location of the package folder

 <configuration> <config> <add key=" repositoryPath" value=" C:\myteam\teampackages" /> </config> ... </configuration> 
+1
source

All Articles