sdk: `dotnet workload` fails with KeyNotFoundException after updating SDKs

Describe the bug

I have VS 17.3 and VSPreview 17.4 installed side-by-side, and I just updated both to latest versions (17.3.5 and 17.4pre2.1). Since the update, my builds started failing with NETSDK1 “missing workload” errors. So I ran dotnet workload restore and it failed with an exception:

PS R:\foo> dotnet workload restore .\src\Foo\Foo.csproj
__________________________________________________
Project "R:\foo\src\Foo\Foo.csproj" (_GetRequiredWorkloads target(s)):

__________________________________________________
Project "R:\foo\src\Foo\Foo.csproj" is building "R:\foo\src\Foo\Foo.csproj" (_GetRequiredWorkloads target(s)):

Done building project "Foo.csproj".
Installing workloads:

Workload installation failed: One or more errors occurred. (The given key 'Microsoft.iOS.Sdk' was not present in the dictionary.)

I ran dotnet workload repair. It claims to have repaired “ios” and “maui” workloads, but my build error and the dotnet-workload exceptions did not go away.

"dotnet workload repair" output
PS R:\foo> dotnet workload repair

Repairing workload installation for workloads: ios maui
Downloading Microsoft.iOS.Sdk.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Sdk.15.4.447.447-x64.msi ....... Done
Downloading Microsoft.iOS.Windows.Sdk.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Windows.Sdk.15.4.447.447-x64.msi ....... Done
Downloading Microsoft.iOS.Ref.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Ref.15.4.447.447-x64.msi ..... Done
Downloading Microsoft.iOS.Runtime.ios-arm.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Runtime.ios-arm.15.4.447.447-x64.msi ...... Done
Downloading Microsoft.iOS.Runtime.ios-arm64.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Runtime.ios-arm64.15.4.447.447-x64.msi ..... Done
Downloading Microsoft.iOS.Runtime.iossimulator-x86.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Runtime.iossimulator-x86.15.4.447.447-x64.msi ...... Done
Downloading Microsoft.iOS.Runtime.iossimulator-x64.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Runtime.iossimulator-x64.15.4.447.447.msi ...... Done
Downloading Microsoft.iOS.Runtime.iossimulator-arm64.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Runtime.iossimulator-arm64.15.4.447.447-x64.msi ...... Done
Downloading Microsoft.iOS.Templates.Msi.x64 (15.4.447)
Installing Microsoft.iOS.Templates.15.4.447.447-x64.msi .... Done
Repairing Microsoft.Mono.ios-arm.6.0.9-x64.msi ........ Done
Repairing Microsoft.Mono.ios-arm64.6.0.9-x64.msi ........ Done
Repairing Microsoft.Mono.iossimulator-arm64.6.0.9-x64.msi ........ Done
Repairing Microsoft.Mono.iossimulator-x64.6.0.9.msi ........ Done
Repairing Microsoft.Mono.iossimulator-x86.6.0.9-x64.msi ....... Done
Repairing Microsoft.MonoAOTCompiler.Task.6.0.9-x64.msi .... Done
Repairing Microsoft.MonoTargets.Sdk.6.0.9-x64.msi ..... Done
Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Ref.android.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Runtime.android.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Runtime.android.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Ref.android.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Ref.android.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Runtime.android.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Runtime.android.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Ref.android.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Ref.android.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Runtime.android.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Runtime.android.6.0.536.0-x64.msi .... Done
Downloading Microsoft.AspNetCore.Components.WebView.Maui.Msi.x64 (6.0.536)
Repairing Microsoft.AspNetCore.Components.WebView.Maui.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Dependencies.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Dependencies.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Sdk.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Sdk.6.0.536.0-x64.msi ..... Done
Downloading Microsoft.Maui.Extensions.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Extensions.6.0.536.0-x64.msi .... Done
Repairing Microsoft.Maui.Graphics.6.0.403-x64.msi .... Done
Downloading Microsoft.Maui.Resizetizer.Sdk.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Resizetizer.Sdk.6.0.536.0-x64.msi ...... Done
Downloading Microsoft.Maui.Templates-6.0.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Templates-6.0.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Ref.any.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Ref.any.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Runtime.any.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Runtime.any.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Ref.any.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Ref.any.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Runtime.any.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Runtime.any.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Ref.any.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Ref.any.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Runtime.any.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Runtime.any.6.0.536.0-x64.msi .... Done
Repairing Microsoft.Android.Sdk.Windows.32.0.448-x64.msi .......... Done
Repairing Microsoft.Android.Ref.31.32.0.448-x64.msi ...... Done
Repairing Microsoft.Android.Runtime.31.android-arm.32.0.448-x64.msi ..... Done
Repairing Microsoft.Android.Runtime.31.android-arm64.32.0.448-x64.msi ..... Done
Repairing Microsoft.Android.Runtime.31.android-x86.32.0.448-x64.msi ..... Done
Repairing Microsoft.Android.Runtime.31.android-x64.32.0.448.msi ..... Done
Repairing Microsoft.Android.Templates.32.0.448-x64.msi .... Done
Repairing Microsoft.Mono.android-arm.6.0.9-x64.msi ....... Done
Downloading Microsoft.NETCore.App.Runtime.Mono.android-arm64.Msi.x64 (6.0.9)
Repairing Microsoft.Mono.android-arm64.6.0.9-x64.msi ........ Done
Repairing Microsoft.Mono.android-x64.6.0.9.msi ........ Done
Repairing Microsoft.Mono.android-x86.6.0.9-x64.msi ....... Done
Repairing Microsoft.AOT.win-x64.Cross.android-x86.6.0.9.msi ..... Done
Repairing Microsoft.AOT.win-x64.Cross.android-x64.6.0.9.msi ..... Done
Repairing Microsoft.AOT.win-x64.Cross.android-arm.6.0.9.msi ..... Done
Repairing Microsoft.AOT.win-x64.Cross.android-arm64.6.0.9.msi ..... Done
Downloading Microsoft.Maui.Core.Ref.ios.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Ref.ios.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Runtime.ios.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Runtime.ios.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Ref.ios.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Ref.ios.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Runtime.ios.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Runtime.ios.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Ref.ios.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Ref.ios.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Runtime.ios.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Runtime.ios.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Ref.tizen.Msi.x64 (6.0.536)
Installing Microsoft.Maui.Core.Ref.tizen.6.0.536.0-x64.msi ..... Done
Downloading Microsoft.Maui.Core.Runtime.tizen.Msi.x64 (6.0.536)
Installing Microsoft.Maui.Core.Runtime.tizen.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Ref.tizen.Msi.x64 (6.0.536)
Installing Microsoft.Maui.Controls.Ref.tizen.6.0.536.0-x64.msi ..... Done
Downloading Microsoft.Maui.Controls.Runtime.tizen.Msi.x64 (6.0.536)
Installing Microsoft.Maui.Controls.Runtime.tizen.6.0.536.0-x64.msi ..... Done
Downloading Microsoft.Maui.Essentials.Ref.tizen.Msi.x64 (6.0.536)
Installing Microsoft.Maui.Essentials.Ref.tizen.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Runtime.tizen.Msi.x64 (6.0.536)
Installing Microsoft.Maui.Essentials.Runtime.tizen.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Ref.maccatalyst.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Ref.maccatalyst.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Runtime.maccatalyst.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Runtime.maccatalyst.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Ref.maccatalyst.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Ref.maccatalyst.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Runtime.maccatalyst.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Runtime.maccatalyst.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Ref.maccatalyst.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Ref.maccatalyst.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Runtime.maccatalyst.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Runtime.maccatalyst.6.0.536.0-x64.msi .... Done
Downloading Microsoft.MacCatalyst.Sdk.Msi.x64 (15.4.447)
Installing Microsoft.MacCatalyst.Sdk.15.4.447.447-x64.msi ..... Done
Downloading Microsoft.MacCatalyst.Ref.Msi.x64 (15.4.447)
Installing Microsoft.MacCatalyst.Ref.15.4.447.447-x64.msi ..... Done
Downloading Microsoft.MacCatalyst.Runtime.maccatalyst-arm64.Msi.x64 (15.4.447)
Installing Microsoft.MacCatalyst.Runtime-arm64.15.4.447.447-x64.msi ..... Done
Downloading Microsoft.MacCatalyst.Runtime.maccatalyst-x64.Msi.x64 (15.4.447)
Installing Microsoft.MacCatalyst.Runtime-x64.15.4.447.447.msi ...... Done
Downloading Microsoft.MacCatalyst.Templates.Msi.x64 (15.4.447)
Installing Microsoft.MacCatalyst.Templates.15.4.447.447-x64.msi .... Done
Repairing Microsoft.Mono.maccatalyst-arm64.6.0.9-x64.msi ........ Done
Repairing Microsoft.Mono.maccatalyst-x64.6.0.9.msi ........ Done
Downloading Microsoft.Maui.Core.Ref.win.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Ref.win.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Core.Runtime.win.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Core.Runtime.win.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Ref.win.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Ref.win.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Controls.Runtime.win.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Controls.Runtime.win.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Ref.win.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Ref.win.6.0.536.0-x64.msi .... Done
Downloading Microsoft.Maui.Essentials.Runtime.win.Msi.x64 (6.0.536)
Repairing Microsoft.Maui.Essentials.Runtime.win.6.0.536.0-x64.msi .... Done
Repairing Microsoft.Maui.Graphics.Win2D.6.0.403-x64.msi .... Done
Removing Microsoft.Maui.Controls.Ref.tizen.6.0.486.0-x64.msi ..... Done
Removing Microsoft.Maui.Controls.Runtime.tizen.6.0.486.0-x64.msi .... Done
Removing Microsoft.Maui.Core.Ref.tizen.6.0.486.0-x64.msi .... Done
Removing Microsoft.Maui.Core.Runtime.tizen.6.0.486.0-x64.msi .... Done
Removing Microsoft.Maui.Essentials.Ref.tizen.6.0.486.0-x64.msi .... Done
Removing Microsoft.Maui.Essentials.Runtime.tizen.6.0.486.0-x64.msi .... Done

Successfully repaired workloads: ios maui

To Reproduce

I’m not sure how to repro this – perhaps it’s a problem with migrating from older VS/dotnet installs.

Exceptions (if any)

When I run dotnet workload list, I got what I suspect is the same error but with more details:

PS R:\foo> dotnet workload list

Installed Workload Ids      Manifest Version      Installation Source
--------------------------------------------------------------------------------
ios                         15.4.447/6.0.400      SDK 6.0.400, VS 17.3.32922.545
maui                        6.0.536/6.0.400       SDK 6.0.400
maui-android                6.0.536/6.0.400       VS 17.3.32922.545
android                     32.0.448/6.0.400      VS 17.3.32922.545
maui-windows                6.0.536/6.0.400       VS 17.3.32922.545
maui-maccatalyst            6.0.536/6.0.400       VS 17.3.32922.545
maccatalyst                 15.4.447/6.0.400      VS 17.3.32922.545
maui-ios                    6.0.536/6.0.400       VS 17.3.32922.545

Use `dotnet workload search` to find additional workloads to install.

Unhandled exception: System.Collections.Generic.KeyNotFoundException: The given key 'Microsoft.iOS.Sdk' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.<>c__DisplayClass30_0.<GetUpdatedWorkloads>b__2(WorkloadPackId p)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.GetUpdatedWorkloads(WorkloadResolver advertisingManifestResolver, IEnumerable`1 installedWorkloads)+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Microsoft.DotNet.Workloads.Workload.List.WorkloadListCommand.Execute()
   at Microsoft.DotNet.Cli.WorkloadListCommandParser.<>c.<ConstructCommand>b__6_0(ParseResult parseResult)
   at Microsoft.DotNet.Cli.ParseResultCommandHandler.Invoke(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Further technical details

My global.json
{
  "sdk": {
    "version": "6.0.300",
    "rollForward": "latestFeature"
  }
}
My "dotnet --info"
PS R:\foo> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.401
 Commit:    0906eae6f8

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.401\

Host:
  Version:      7.0.0-rc.1.22426.10
  Architecture: x64
  Commit:       06aceb7015

.NET SDKs installed:
  2.1.526 [C:\Program Files\dotnet\sdk]
  2.1.818 [C:\Program Files\dotnet\sdk]
  3.1.423 [C:\Program Files\dotnet\sdk]
  5.0.412 [C:\Program Files\dotnet\sdk]
  6.0.401 [C:\Program Files\dotnet\sdk]
  7.0.100-rc.1.22431.12 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0-rc.1.22427.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.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 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0-rc.1.22426.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0-rc.2.20475.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0-rc.1.22427.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  R:\foo\global.json

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 27 (9 by maintainers)

Most upvoted comments

Same issue here. Ver. 17.3.5 and 17.4.0 Preview 2.1. Is there a workaround? I can’t develop any further now. Missing workload for specified target framework. Tizen is already deactivated in the project file. Error remains the same. Sorry if this is the wrong place to ask, but I haven’t found anything else. Thank you.

Repair just reruns the msis for already installed workloads and so shouldn’t be needed in this case. The problem here is that an older set of packs is installed compared with the versions found in the advertising manifests to install next and there was a breaking name change between the two and the SDK logic didn’t handle that correctly. A fix is going in for this for the 7.0.100 release but I’m not sure how best to workaround this other than trying to uninstall all workloads.

@dsplaisted any ideas on better workarounds? Can they delete the advertising manifests from %temp%\Temp\dotnet-sdk-advertising-temp and then use a rollback file to force an update perhaps?

I hoped running dotnet workload repair would do the trick; it didn’t.

I was able to successfully run dotnet workload uninstall ios, after which I ran dotnet workload restore which finally completed.

First do :

dotnet workload list

Then for each workload do:

dotnet workload uninstall <name of the workload>

And finally:

dotnet workload install maui-ios maui-android

Thanks Microsoft

@matt-goldman thanks for the logs in email. Someone on the team is looking through them. We also have some folks trying to set up a repro of the situation. Our best guess is you have to have 17.3 + 17.4 + have installed workloads in 17.3 prior to updating either to the latest version. That would leave older packs installed on the machine from the initial install but the new installs should bring in later manifests and later advertising manifests.

The next thing to check is to have someone zip up the contents of their advertising manifest folder in the %temp%\dotnet-sdk-advertising-temp. Basically, from code there are different packs+manifests installed into the SDK than the versions we pre-download into the advertising temp location to check for updates.