Description
Describe the bug
On WSL Linux, dotnet nuget config paths
will consider a file named nuget.config
, NuGet.config
, or NuGet.Config
at the solution/project root.
On Windows, accessing the project via WSL UNC paths or mapped drives, dotnet nuget config paths
will only consider a file named NuGet.Config
.
The CLI tools should be consistent across OSes regarding which NuGet config filenames are considered.
To Reproduce
In WSL, create a new project
$ mkdir NugetIssue
$ cd NugetIssue
$ dotnet new console
Create a Nuget config file named nuget.config
with the following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
In WSL, check that the NuGet config file will be considered:
$ dotnet nuget config paths
/home/paul/dev/NugetIssue/nuget.config
/home/paul/.nuget/NuGet/NuGet.Config
In a Windows CMD or PowerShell prompt, navigate to the WSL directory:
PS C:\Users\paulmedynski> D:
PS D:\> cd \home\paul\dev\NugetIssue
In this case, I have mapped the root filesystem of my WSL distro to D: in Windows, since CMD doesn't support UNC paths. Using the full UNC path in PowerShell exhibits the same behaviour.
Check what config files NuGet will consider:
PS D:\home\paul\dev\NugetIssue> dotnet nuget config paths
C:\Users\paulmedynski\AppData\Roaming\NuGet\NuGet.Config
Rename the config file to "NuGet.Config":
PS D:\home\paul\dev\NugetIssue> move nuget.config NuGet.config
PS D:\home\paul\dev\NugetIssue> dotnet nuget config paths
D:\home\paul\dev\NugetIssue\NuGet.Config
C:\Users\paulmedynski\AppData\Roaming\NuGet\NuGet.Config
Note that when the project lives on a native local Windows filesystem, NuGet considers the same set of config filenames as it does on Linux. It is only when accessing the project via a WSL UNC path that NuGet's behaviour restricts to "NuGet.Config".
Further technical details
WSL Linux:
$ dotnet --info
.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.12+1cce77968
Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/9.0.101/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
9.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
/home/paul/dev/sandbox/ctaip/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Windows 11:
dotnet --info
.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.12+1cce77968
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.101\
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
9.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
C:\Users\paulmedynski\dev\ctaip\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download