-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dotnet-sdk-9.0.100-preview.5.24281.15] Fail to build the app after retargeted to .NET 9.0 with error “System.ArgumentException: An item with the same key has already been added.” #56029
Comments
@Junjun-zhao thanks for contacting us. What's happening here is that |
Thanks @javiercn for looking into this issue so quickly. This issue has been added to 9.0-preview7 milestone, so it is not a blocker for .NET 9 Preview5, is it right? |
No |
No ? |
@Junjun-zhao this was fixed in preview6, please give it a try with a newer SDK version |
@javiercn Verified this issue with dotnet-sdk-9.0.100-preview.7.24379.15, it has been fixed. |
I don't believe this has been fixed in Preview 7. I am now experiencing it in my projects. It happens when the .NET 9.0 SDK tries to build a .NET 8.0 WebAssembly project. |
@javiercn It looks to me like this line: var staticWebAssets = CandidateAssets.Select(StaticWebAsset.FromTaskItem).ToDictionary(a => a.Identity); needs to be changed to var staticWebAssets = CandidateAssets.Select(StaticWebAsset.FromTaskItem).DistinctBy(a => a.Identity).ToDictionary(a => a.Identity); But I could be wrong. |
@robertmclaws We verified the affected three apps in our lab with .NET 9 Preview 7 build 9.0.100-preview.7.24407.12 , the issue does not repro that all of them could be built and published successfully. But they are not blazor web assembly apps. Are you using the .NET 9 P7 build 9.0.100-preview.7.24407.12? Do you have a demo or github project link? |
Output from
Luckily the solution I was trying to upgrade was OSS. If you pull down this codebase and try to build in on VS 17.12 Preview 1, you will run into the issue when you get to building
Can I ask why the team did not test these changes will ALL permutations of the new .targets file? WebAssembly is not an edge case, not testing this with those libraries seems like a MASSIVE oversight. |
Same here. After updating my VS preview version to 9.0.100-preview.7.24407.12 [C:\Program Files\dotnet\sdk], starting to see the |
Thanks @robertmclaws. Hi @javiercn It prompts the same error message regarding "DefineStaticWebAssetEndpoints" task, but the stack trace is a little different from this issue. We have designed a minimal demo and file a new issue #57423 for tracking. Could you please take a look at? Thanks. |
Is there an existing issue for this?
Describe the bug
When retarget the 3rd party application to net9.0 with the latest .NET 9 build, it failed to build with error
"The "DefineStaticWebAssetEndpoints" task failed unexpectedly. System.ArgumentException: An item with the same key has already been added.".
Application Name: NSK, Blazorise, OpenMu
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-preview.5.24281.15
App & Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2069020
Github Link:
https://github.com/andysal/NSK
https://github.com/Megabit/Blazorise
https://github.com/MUnique/OpenMU
Verify Scenarios:
1). Windows 10 21H2 AMD64 + dotnet-sdk-8.0.301: Pass
2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.4.24267.66: Pass
3). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.5.24277.8: Fail
4). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.5.24281.15: Fail
Expected Behavior
build successfully.
Steps To Reproduce
Minimal Repro steps (Demo attached): BlazorAppDemo (1).zip
Exceptions (if any)
Show error MSB4018:
.NET Version
dotnet-sdk-9.0.100-preview.5.24281.15
Anything else?
@dotnet-actwx-bot @dotnet/compat
The text was updated successfully, but these errors were encountered: