dotnet restore | build | publish do not respect nuget.config repository path
See original GitHub issueSteps to reproduce
use cli to restore | build | publish a project which has a nuget.config with a specific repository path.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
</packageRestore>
...
<config>
<add key="repositoryPath" value=".\utpackage" />
</config>
...
</configuration>
however if you create the following global.json in the same directory it functions as expected:
{
"packages": "utpackage"
}
Expected behavior
dotnet cli should respect both global.json packages property and nuget.config repositoryPath
Actual behavior
if only the nuget.config is present packages are restored to and referenced from the global packages cache
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-rc2-002468)
Product Information: Version: 1.0.0-rc2-002468 Commit Sha: a2f3c531fb
Runtime Environment: OS Name: Windows OS Version: 10.0.14318 OS Platform: Windows RID: win10-x64
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (12 by maintainers)
Top Results From Across the Web
Dotnet restore does not honour nuget.config 'repositoryPath'
The model is the identity is id + version and that's it. The repository path will never be respected. It is the path...
Read more >dotnet restore command - .NET CLI
Specify feeds. To restore the dependencies, NuGet needs the feeds where the packages are located. Feeds are usually provided via the nuget.
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 >NuGet packages in the Package Registry
Publish NuGet packages in your project's Package Registry. Then, install the packages whenever you need to use them as a dependency.
Read more >Dotnet restore clean. cs files) Removing information from ...
For example: msbuild <file name>. The folder does not have any spaces in it. The NuGet package restorer used to restore solution packages....
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
The order should be:
--packages
NUGET_PACKAGES
globalPackagesFolder
from nuget.configdotnet restore reads the packages parameter first here: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Commands/RestoreCommand/RequestFactory/RestoreArgs.cs#L68-L80
Then checks the environment variable and settings here: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Configuration/Utility/SettingsUtility.cs#L127-L154
The global folder path in
global.json
was deprecated and is not used by NuGet.repositoryPath
refers to to the packages folder for packages.config and should not be used with project.jsonI reread the issue and realized I offered a workaround instead of a fix. Will open an issue on nuget/home instead, link to this one, and then close this one. It is up to nuget xplat to honor this configuration.