Build error - MSB4018: The "DefineStaticWebAssets" task failed unexpectedly.
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Build-error---MSB4018:-The-DefineStatic/10954694)._
---
[severity:It's more difficult to complete my work]
I have cloned a repository which I have not worked on before which contains a solution with multiple projects.
When I try to build the solution I get the same build error which effects 4 projects (Other projects are not effected)...
>MSB4018 - The "DefineStaticWebAssets" task failed unexpectedly.
System.ArgumentException: An item with the same key has already been added.
**System information:**
_IDE and version:_ Visual Studio Community 2022 version: 17.14.13 (August 2025)
_SDK version:_ 9.0.304
**Steps I have taken to try and fix the problem myself:**
- Cleared NuGet local packages, deleted existing bin and obj directories in all projects and Re-built the solution.
- Uninstalled and reinstalled Visual Studio
- Uninstalled and reinstalled Visual Studio using the .vsconfig from someone who has no issues building the project.
- Deleted the solution completely and cloned a fresh copy.
- Studied the Build Log to ascertain what the actual error is.
All of these steps have made no difference and I keep getting the same build error.
I have submitted the Build Log so you can see in more detail where the problems lie.
---
### Original Comments
#### Feedback Bot on 8/22/2025, 07:46 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.