Dotnet restore does not honour nuget.config 'repositoryPath'
See original GitHub issueSteps to reproduce
dotnet new
in an empty directory- Add the following nuget.config to the same directory
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="c:\packages" />
</config>
<packageSources>
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
dotnet restore
in the same directory
Expected behavior
Packages for the solution are restored to c:\packages
Actual behavior
Packages for the solution are restored to c:\users<username>.nuget\packages
Environment data
.NET Command Line Tools (1.0.0-preview1-002702)
Product Information: Version: 1.0.0-preview1-002702 Commit Sha: 6cde21225e
Runtime Environment: OS Name: Windows OS Version: 6.3.9600 OS Platform: Windows RID: win81-x64
Additional
I understand that the packages path can be passed as an argument to the dotnet restore
command, however this only works at the CLI level, what happens when Visual Studio does a restore?
Previously, the packages path could be provided in the global.json (for DNX/RC1 ASP.NET projects) but this also no longer works.
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Dotnet restore does not honour nuget.config 'repositoryPath'
I understand that the packages path can be passed as an argument to the dotnet restore command, however this only works at the...
Read more >NuGet Package Restore
NuGet Package Restore restores all of a project's dependencies that are listed in either a project file or a packages.config file. You can...
Read more >Nuget package restore not respecting my repository path ...
(2) I edited the csproj file and noticed that the entry for packages.config had a <SubType>Designer</SubType> inner tag, which I removed. I ...
Read more >Visual-studio – Change NuGet package location folder
I want to change NuGet package folder, but it does not change it. ... Dotnet restore does not honour nuget.config 'repositoryPath'. Update:.
Read more >nuget package not found when using local nuget.config ...
error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@emgarten Thank you, I think that clears up the issue.
To confirm, creating a config as follows
and performing
dotnet restore
at the root of a solution restores packages to c:\packagesI can also confirm that performing restore in Visual Studio also recognised the configuration and restored to the configured path.
Question: Setting the value to simply packages (or any relative path) creates a packages folder relative to the project.json for each project in a solution that is restored. Is that expected behaviour?
I think
dotnet
and nuget in general prefer using theNUGET_PACKAGES
environment variable now.