Two workloads using the same pack cause MSBuildWorkloadSdkResolver to fail
See original GitHub issueExample: 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:
- Created 2 years ago
- Comments:11 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 (leavingsdk-manifests
to be empty).The use of
TryAdd()
and messages in https://github.com/dotnet/sdk/commit/5cdb5bed23b48305364310aebf63b9e6eda294d6, seems great to me. I think we can close this.