question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Two workloads using the same pack cause MSBuildWorkloadSdkResolver to fail

See original GitHub issue

Example: https://github.com/xamarin/xamarin-android/pull/5539

I added this to the Android workload:

"Microsoft.NET.Runtime.MonoAOTCompiler.Task": {
  "kind": "sdk",
  "version": "6.0.0-preview.4.21177.4"
},

This is also used by dotnet\sdk-manifests\6.0.100\Microsoft.NET.Workload.BlazorWebAssembly\WorkloadManifest.json.

With both workloads using the same pack, dotnet restore fails with:

C:\Users\jopepper\android-toolchain\dotnet\sdk\6.0.100-preview.4.21179.4\MSBuild.dll -nologo -bl -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Users\jopepper\android-toolchain\dotnet\sdk\6.0.100-preview.4.21179.4\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Users\jopepper\android-toolchain\dotnet\sdk\6.0.100-preview.4.21179.4\dotnet.dll -maxcpucount -target:Restore -verbosity:m HelloAndroid\HelloAndroid.csproj
C:\src\net5-samples\HelloAndroid\HelloAndroid.csproj : warning MSB4242: The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed to run. An item with the same key has already been added. Key: Microsoft.NET.Runtime.MonoAOTCompiler.Task
C:\Users\jopepper\android-toolchain\dotnet\sdk\6.0.100-preview.4.21179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props(14,3): warning MSB4242: The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed to run. An item with the same key has already been added. Key: Microsoft.NET.Runtime.MonoAOTCompiler.Task
C:\Users\jopepper\android-toolchain\dotnet\sdk\6.0.100-preview.4.21179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.props(14,3): warning MSB4242: The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed to run. An item with the same key has already been added. Key: Microsoft.NET.Runtime.MonoAOTCompiler.Task
C:\Users\jopepper\android-toolchain\dotnet\sdk\6.0.100-preview.4.21179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(16,3): warning MSB4242: The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed to run. An item with the same key has already been added. Key: Microsoft.NET.Runtime.MonoAOTCompiler.Task
  Determining projects to restore...
C:\Users\jopepper\android-toolchain\dotnet\sdk\6.0.100-preview.4.21179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(109,5): error NETSDK1139: The target platform identifier android was not recognized. [C:\src\net5-samples\HelloAndroid\HelloAndroid.csproj]

Logs: msbuild.zip

I hit this using .NET 6.0.100-preview.4.21179.4.

To workaround I can completely delete this folder and dotnet restore succeeds:

dotnet\sdk-manifests\6.0.100\Microsoft.NET.Workload.BlazorWebAssembly

/cc @dsplaisted @wli3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
chuckercommented, Jun 17, 2021

Hit this locally when running dotnet new blazorwasm with a fresh P5 SDK: https://gist.github.com/CoffeeFlux/ee4d2a255d593095933cca9f01c7e85e

@CoffeeFlux

If you don’t need to use MAUI, see if you have a folder /usr/local/share/dotnet/sdk-manifests/6.0.100 and try deleting that (leaving sdk-manifests to be empty).

0reactions
jonathanpepperscommented, Jun 17, 2021

The use of TryAdd() and messages in https://github.com/dotnet/sdk/commit/5cdb5bed23b48305364310aebf63b9e6eda294d6, seems great to me. I think we can close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SDK Resolver Failure - Net 7 - Net 6
NET 7 faulty workload ('wasm-tools'), since any attempt to uninstall or repair it ended up in the same error message.
Read more >
NETSDK1147: Missing workload for specified target ...
This error is caused by trying to compile a project that requires an optional workload, but you don't have the workload installed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found