When I have this command line:
nuget.exe restore "[somedir]\[somesln].sln"
it fails to respect the nuget.config (in the SLN directory). I have to force it into this:
nuget.exe restore "[somedir]\[somesln].sln" -PackageDirectory "[samevalueasinnuget.config]"
Comments: Further info: nuget.config in the $(solutionDir) also works, i.e. the repositoryPath specified there is used by nuget.exe restore. Steps to verify that it works: - Create a new project C:\temp\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj. Save the solution as C:\temp\ConsoleApplication3\ConsoleApplication3.sln. - Create file C:\temp\ConsoleApplication3\nuget.config, with content: ``` <?xml version="1.0" encoding="utf-8"?> <configuration> <config> <add key="repositoryPath" value="c:\temp\test1" /> </config> </configuration> ``` - Close the solution, then reopen it in VS so that the settings in C:\temp\ConsoleApplication3\nuget.config take effect. - Install package Json.Net (Newtonsoft.Json). You can see that the package is installed in C:\temp\test1\Newtonsoft.Json.5.0.6. - Save and close the solution. - Delete directory C:\temp\test1\. - Open cmd, run ``` NuGet.exe restore c:\temp\ConsoleApplication3\ConsoleApplication3.sln ``` you should see messages like ``` Installing 'Newtonsoft.Json 5.0.6'. Successfully installed 'Newtonsoft.Json 5.0.6'. ``` - You can see that the package is restored in C:\temp\test1\Newtonsoft.Json.5.0.6. The version of nuget.exe that I used is 2.7.40906.213
nuget.exe restore "[somedir]\[somesln].sln"
it fails to respect the nuget.config (in the SLN directory). I have to force it into this:
nuget.exe restore "[somedir]\[somesln].sln" -PackageDirectory "[samevalueasinnuget.config]"
Comments: Further info: nuget.config in the $(solutionDir) also works, i.e. the repositoryPath specified there is used by nuget.exe restore. Steps to verify that it works: - Create a new project C:\temp\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj. Save the solution as C:\temp\ConsoleApplication3\ConsoleApplication3.sln. - Create file C:\temp\ConsoleApplication3\nuget.config, with content: ``` <?xml version="1.0" encoding="utf-8"?> <configuration> <config> <add key="repositoryPath" value="c:\temp\test1" /> </config> </configuration> ``` - Close the solution, then reopen it in VS so that the settings in C:\temp\ConsoleApplication3\nuget.config take effect. - Install package Json.Net (Newtonsoft.Json). You can see that the package is installed in C:\temp\test1\Newtonsoft.Json.5.0.6. - Save and close the solution. - Delete directory C:\temp\test1\. - Open cmd, run ``` NuGet.exe restore c:\temp\ConsoleApplication3\ConsoleApplication3.sln ``` you should see messages like ``` Installing 'Newtonsoft.Json 5.0.6'. Successfully installed 'Newtonsoft.Json 5.0.6'. ``` - You can see that the package is restored in C:\temp\test1\Newtonsoft.Json.5.0.6. The version of nuget.exe that I used is 2.7.40906.213