sdk: dotnet restore | build | publish do not respect nuget.config repository path
Steps 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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (12 by maintainers)
The order should be:
--packagesNUGET_PACKAGESglobalPackagesFolderfrom 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.jsonwas deprecated and is not used by NuGet.repositoryPathrefers to to the packages folder for packages.config and should not be used with project.json