sdk: `dotnet workload` commands do not authenticate properly
Describe the bug
I am trying to update/install workloads from an internal feed, and the authentication does not seem to carry through properly to the dotnet workload install commands.
I can restore and build normal csproj and they have no issues.
The first hurdle was the --interactive does nothing, so I had to create a dummy csproj. But, after that we get a 401 error on the feeds.
To Reproduce
Install a dotnet workload using a rollback file with a version on an internal feed.
I can’t share exact urls and deets here, but the log is basically this BEFORE authentication (with/without --interactive):
> dotnet workload update --source https://pkgs.dev.azure.com/private/index.json --verbosity diagnostic
No workloads installed for this feature band. To update workloads installed with earlier SDK versions, include the --from-previous-sdk option.
Failed to update the advertising manifest microsoft.net.sdk.android: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Failed to update the advertising manifest microsoft.net.sdk.ios: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maccatalyst: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Failed to update the advertising manifest microsoft.net.sdk.macos: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maui: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Failed to update the advertising manifest microsoft.net.sdk.tvos: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Failed to update the advertising manifest microsoft.net.workload.emscripten: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json..
Downloading microsoft.net.sdk.android.manifest-6.0.100.msi.x64 (31.0.101-preview.10.30)
Workload installation failed. Rolling back installed packs...
Downloading microsoft.net.sdk.maui.manifest-6.0.100.msi.x64 (6.0.101-preview.9.1805)
Installation rollback failed: One or more errors occurred. (Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json.)
Workload update failed: One or more errors occurred. (Unable to load the service index for source https://pkgs.dev.azure.com/private/index.json.)
If I create a dummy project and add a package and do the auth, then the log is different:
> dotnet workload update --source https://pkgs.dev.azure.com/private/index.json --verbosity diagnostic
No workloads installed for this feature band. To update workloads installed with earlier SDK versions, include the --from-previous-sdk option.
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.sdk.android.manifest-6.0.100/index.json
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.sdk.ios.manifest-6.0.100/index.json
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.sdk.maccatalyst.manifest-6.0.100/index.json
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.sdk.macos.manifest-6.0.100/index.json
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.sdk.maui.manifest-6.0.100/index.json
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.sdk.tvos.manifest-6.0.100/index.json
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.workload.emscripten.manifest-6.0.100/index.json
[NuGet Manager] [Info] GET https://pkgs.dev.azure.com/private/microsoft.net.workload.mono.toolchain.manifest-6.0.100/index.json
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.sdk.macos.manifest-6.0.100/index.json 558ms
Failed to update the advertising manifest microsoft.net.sdk.macos: Response status code does not indicate success: 401 (Unauthorized)..
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.sdk.ios.manifest-6.0.100/index.json 1376ms
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.sdk.maccatalyst.manifest-6.0.100/index.json 1358ms
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.sdk.maui.manifest-6.0.100/index.json 1334ms
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.sdk.tvos.manifest-6.0.100/index.json 1318ms
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.workload.emscripten.manifest-6.0.100/index.json 1444ms
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.sdk.android.manifest-6.0.100/index.json 1646ms
[NuGet Manager] [Info] Unauthorized https://pkgs.dev.azure.com/private/microsoft.net.workload.mono.toolchain.manifest-6.0.100/index.json 1449ms
Failed to update the advertising manifest microsoft.net.sdk.ios: Response status code does not indicate success: 401 (Unauthorized)..
Failed to update the advertising manifest microsoft.net.sdk.maccatalyst: Response status code does not indicate success: 401 (Unauthorized)..
Failed to update the advertising manifest microsoft.net.sdk.maui: Response status code does not indicate success: 401 (Unauthorized)..
Failed to update the advertising manifest microsoft.net.sdk.tvos: Response status code does not indicate success: 401 (Unauthorized)..
Failed to update the advertising manifest microsoft.net.workload.emscripten: Response status code does not indicate success: 401 (Unauthorized)..
Failed to update the advertising manifest microsoft.net.sdk.android: Response status code does not indicate success: 401 (Unauthorized)..
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: Response status code does not indicate success: 401 (Unauthorized)..
Downloading microsoft.net.sdk.android.manifest-6.0.100.msi.x64 (31.0.101-preview.10.30)
Workload installation failed. Rolling back installed packs...
Downloading microsoft.net.sdk.maui.manifest-6.0.100.msi.x64 (6.0.101-preview.9.1805)
Installation rollback failed: One or more errors occurred. (Response status code does not indicate success: 401 (Unauthorized).)
Workload update failed: One or more errors occurred. (Response status code does not indicate success: 401 (Unauthorized).)
Exceptions (if any)
Further technical details
.NET SDK (reflecting any global.json):
Version: 6.0.100-rc.2.21478.25
Commit: e3936c2261
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22468
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-rc.2.21478.25\
Host (useful for support):
Version: 6.0.0-rc.2.21474.18
Commit: d1c6659c2d
.NET SDKs installed:
2.1.816 [C:\Program Files\dotnet\sdk]
3.1.411 [C:\Program Files\dotnet\sdk]
5.0.205 [C:\Program Files\dotnet\sdk]
5.0.302 [C:\Program Files\dotnet\sdk]
5.0.400 [C:\Program Files\dotnet\sdk]
6.0.100-rc.1.21458.32 [C:\Program Files\dotnet\sdk]
6.0.100-rc.1.21463.6 [C:\Program Files\dotnet\sdk]
6.0.100-rc.2.21474.31 [C:\Program Files\dotnet\sdk]
6.0.100-rc.2.21478.25 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.2.21470.37 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.2.21475.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.2.21470.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.2.21474.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.7.21378.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.2.21470.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.2.21475.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (23 by maintainers)
We’ve confirmed that adding a PAT in the nuget.config works for 6.0.100. I’ll target the
--interactivefix for 6.0.2xx.The if check here is not needed, https://github.com/dotnet/sdk/blob/599fde6a0276a1e9d8eefea4ee4e4a4f9518bfd8/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs#L79.
The service should always be setup, not only in interactive mode.
See the equivalent NuGet side, https://github.com/NuGet/NuGet.Client/blob/2afc1e1d01dbf880b2ed0ce5c3fa52fb67dda080/src/NuGet.Core/NuGet.Build.Tasks/BuildTasksUtility.cs#L180