Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet config file name inconsistent when accessing via WSL UNC paths #13989

Open
paulmedynski opened this issue Dec 6, 2024 · 1 comment
Open
Labels
Area:Settings NuGet.Config and related issues Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Product:NuGet.exe NuGet.exe Type:Bug

Comments

@paulmedynski
Copy link

NuGet Product Used

dotnet.exe, NuGet.exe

Product Version

9.0.101

Worked before?

Unknown

Impact

It bothers me. A fix would be nice

Repro Steps & Context

Describe the bug

On WSL Linux and Windows, with the project on the local filesystem, 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 regarding which NuGet config filenames are considered regardless of paths or filesystems.

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>
  </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

Additionally, the public documentation regarding NuGet configs uses a mix of NuGet.Config and nuget.config, making it unclear exactly which config filenames are supported by default:

https://learn.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior

Verbose Logs

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
@paulmedynski
Copy link
Author

I originally submitted this issue to the .NET SDK project:

dotnet/sdk#45357

@kartheekp-ms kartheekp-ms added Product:NuGet.exe NuGet.exe Area:Settings NuGet.Config and related issues Product:dotnet.exe and removed Triage:Untriaged labels Dec 7, 2024
@nkolev92 nkolev92 added the Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Settings NuGet.Config and related issues Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Product:NuGet.exe NuGet.exe Type:Bug
Projects
None yet
Development

No branches or pull requests

3 participants