I have a Blazor WASM app running on .Net Standard 2.1 which has suddenly started showing the following error whenever I try to build the app.
The static web asset 'C:\MyProject\wwwroot\appsettings.json' has a conflicting web root path '/wwwroot/appsettings.json' with the project file 'wwwroot\appsettings.json'.
Double-clicking the build error takes me to the following section in the file:
C:\Program Files\dotnet\sdk\5.0.201\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets
<ValidateStaticWebAssetsUniquePaths
StaticWebAssets="@(_ReferencedStaticWebAssets)"
WebRootFiles="@(_WebRootFiles)" />
I have been developing the app over the last several weeks, and have never had this build error before.
Nothing has changed with regards to the client-side appsettings.json file.
I've tried deleting the bin and obj folders, cleaning the project, and doing a full rebuild - all to no effect.
Some articles I've found (e.g. https://docs.telerik.com/blazor-ui/knowledge-base/static-asset-conflicting-root-path ) suggest deleting the "_content" folder, but I have no such folder.
I've come to a grinding halt.
Does anyone have any suggestions that I might try?
Many thanks.
It's hard to solve this error without seeing your project and file structure, but one thing you can look for is whether you have an appsettings.json file at the same directory in both Server and Client projects. (For ASP.NET Core hosted Blazor)