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 #45357

Closed
paulmedynski opened this issue Dec 6, 2024 · 2 comments
Closed
Labels
Area-NuGet untriaged Request triage from a team member

Comments

@paulmedynski
Copy link

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
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NuGet untriaged Request triage from a team member labels Dec 6, 2024
Copy link
Contributor

Thanks for creating this issue! We believe this issue is related to NuGet tooling, which is maintained by the NuGet team. Thus, we closed this one and encourage you to raise this issue in the NuGet repository instead. Don’t forget to check out NuGet’s contributing guide before submitting an issue!

If you believe this issue was closed out of error, please comment to let us know.

Happy Coding!

@paulmedynski
Copy link
Author

I have opened a NuGet project issue:

NuGet/Home#13989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NuGet untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant