aspnetcore: [Blazor] DefineStaticWebAssetEndpoints unexpected exception
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
After migrating a WASM Blazor project from net8 to net9 I’m having an exception at build time
Error (active) MSB4018 The “DefineStaticWebAssetEndpoints” task failed unexpectedly. System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer`1 comparer) at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssetEndpoints.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AccordionExplorer.Client C:\Program Files\dotnet\sdk\9.0.100-preview.4.24267.66\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Compression.targets 227
Expected Behavior
No exception should happen and the application should be build normally
Steps To Reproduce
No response
Exceptions (if any)
Error (active) MSB4018 The “DefineStaticWebAssetEndpoints” task failed unexpectedly.
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer`1 comparer)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssetEndpoints.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AccordionExplorer.Client C:\Program Files\dotnet\sdk\9.0.100-preview.4.24267.66\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Compression.targets 227
.NET Version
9.0.100-preview.4.24267.66
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 15 (4 by maintainers)
Looks like this problem is back in 9.0.0-preview.7.24405.7
Just got the same exception after upgrading today.
@webprofusion-chrisc I quoted you, I did not copy you.
I’m facing the same issue here. Could not compile my Blazor .Net 8 solution anymore, because of a local js file. Had to fully uninstall .Net 9 with VS 17.12 to get rid of .net 9. Very annoying.
I have the same issue with : 9.0.100-preview.7.24407.12