I recently updated the .NET version and the VS version to 9.0 and I'm getting this error:
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, IEqualityComparer1 comparer)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssetEndpoints.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26. MoveNext()
I tried these steps:
.csproj
I am new to .NET and looking for an answer for this issue.
There is update recently. This issue exist in .NET9.0.100-preview.7. But a release candidate verison .NET9.0.100-rc.1 has just release at Sep 10th. You could try the latest version and this issue has disappeared.