Search code examples
asp.net-coreblazor-webapp.net-9.0

How to run Microsoft.FluentUI.AspNetCore.Components library on NET9


Simple setup: Create a new Blazor Web App with Auto and Per Page/Component solutions. Add a new Razor class library to contain the components, add Microsoft's Fluent UI Blazor Components library. This library is then referenced in the Client project, but the build fails. The output error message says the following:

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.d__26.MoveNext() BlazorApp9TestUI.Client C:\Users\xxxx.nuget\packages\microsoft.net.sdk.webassembly.pack\9.0.0-preview.7.24405.7\build\Microsoft.NET.Sdk.WebAssembly.Browser.targets 347

I tried installing the FluentUI library directly into the Client project, and it worked. Has anyone else run into the same issue?


Solution

  • I'm closing this as I installed a newer version of .NET 9, and the problem disappeared.