Skip to content

.NET 10 update causes Error MSB4018: The "ManagedToNativeGenerator" task failed unexpectedly #121877

@williambuchanan2

Description

@williambuchanan2

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Blazor WASM project - builds fine with .NET 9, also builds fine with .NET 10 on developer PC, fails with the below error on Azure Devops Pipeline.

C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: The "ManagedToNativeGenerator" task failed unexpectedly. [D:\a\1\s\NetCore\Client\PDS.Web\Site\PDS.Web.csproj]
C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: System.IO.FileLoadException->Microsoft.Build.Framework.BuildException.GenericBuildTransferredException: The assembly 'Microsoft.Build.Locator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9dff12846e04bfbd' has already loaded been loaded into this MetadataLoadContext.

I don't know what 'Microsoft.Build.Locator' is - we don't reference it, so I suspect something else is...

Expected Behavior

No response

Steps To Reproduce

Update to .NET 10

Exceptions (if any)

C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: The "ManagedToNativeGenerator" task failed unexpectedly. [D:\a\1\s\NetCore\Client\PDS.Web\Site\PDS.Web.csproj]
C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: System.IO.FileLoadException->Microsoft.Build.Framework.BuildException.GenericBuildTransferredException: The assembly 'Microsoft.Build.Locator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9dff12846e04bfbd' has already loaded been loaded into this MetadataLoadContext. [D:\a\1\s\NetCore\Client\PDS.Web\Site\PDS.Web.csproj]
C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: at System.Reflection.MetadataLoadContext.LoadFromStreamCore(Stream peStream) [D:\a\1\s\NetCore\Client\PDS.Web\Site\PDS.Web.csproj]
C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: at Microsoft.WebAssembly.Build.Tasks.ManagedToNativeGenerator.ExecuteInternal(LogAdapter log) [D:\a\1\s\NetCore\Client\PDS.Web\Site\PDS.Web.csproj]
C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: at Microsoft.WebAssembly.Build.Tasks.ManagedToNativeGenerator.Execute() [D:\a\1\s\NetCore\Client\PDS.Web\Site\PDS.Web.csproj]
C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.0\Sdk\WasmApp.Common.targets(771,5): error MSB4018: at Microsoft.Build.CommandLine.OutOfProcTaskAppDomainWrapperBase.InstantiateAndExecuteTask(IBuildEngine oopTaskHostNode, LoadedType taskType, String taskName, String taskLocation, String taskFile, Int32 taskLine, Int32 taskColumn, IDictionary`2 taskParams) [D:\a\1\s\NetCore\Client\PDS.Web\Site\PDS.Web.csproj]

.NET Version

10

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions