i just wanted to publish my changes to my .Net6 blazor wasm app to azure to update it like i did a dozen times. Since yesterday that does not work anymore. I can build and run it locally with no problem but when I try to publish it, I get a window telling me:
Publish has encountered an error. Build failed. Check the Output
window for more details.A diagnostic log has been written to the following location:
"C:UsersuserAppDataLocalTemptmpE865.tmp"
Content of that file:
16.06.2022 08:20:08 System.AggregateException: One or more errors occurred. —> Microsoft.WebTools.Shared.Exceptions.WebToolsException:
Build failed. Check the Output window for more details. — End of
inner exception stack trace —
—> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed.
Check the Output window for more details.<—Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed.
Check the Output window for more details.===================
Console Output:
C:Program Filesdotnetsdk6.0.400-preview.22301.10SdksMicrosoft.NET.Sdk.BlazorWebAssemblytargetsMicrosoft.NET.Sdk.BlazorWebAssembly.6_0.targets(614,5): Error MSB6006: "dotnet.exe" exited with code 1.
Tried fetching older versions of the code that I successfully published a few days ago. Still does not work. My coworker can still publish the same code.
But I can publish my API Backend…so this error seems to be related to blazor wasm.
Tried this with the latest release of VS 2022 and just gave the preview version a try – no luck.
I’ve also done a repair installation of the .Net 6 SDK.
Edit: I’ve tried to publish my project to a folder and got the same error. So no relation to azure. Then I’ve created a new blank Blazor app…I can publish this one to a folder with no error. So my project is somehow broken…but even older code can’t be published. This is so odd…
5
Answers
In my case, changing the SDK in the YAML of the pipeline fixed the issue for us.
In UseDotNet@2 task:
Changed : version: ‘6.0.x’
To : version: ‘6.0.106’
It was working before so it seems like something has changed in the hosts.
@XSharp is correct.
We had same issue started occurring yesterday.
We were using version ‘6.0.x’ of DotNet which seems to have started using version ‘6.0.301’ that seems to be causing this issue. Force it to use the previous version ‘6.0.106’ instead
Just add the following at the top of your tasks in your YAML
Looks like someone has reported it as an issue when having a blank space in your project path: https://github.com/dotnet/core/issues/7548
Same issue for me. Publish stopped working after the latest VS update.
Removing blanks in path resolved it
I kept getting error "Microsoft.NET.Sdk.Blazor WebAssembly.6_0.targets(614,5): error MSB6006".
I can confirm once I removed spaces (my directory to mydirectory) on the build environment, the blazor build was successful.
I’ve had this problem off-and-on for more than a year. Sometimes it seems to be caused by a Visual Studio update and sometimes a dependency (nuget) update, but sometimes it seems spontaneous; I can’t seem to figure out the real cause. This time I tried removing spaces from the path, but that did not work.
I got it to publish again after (1) removing spaces from the path, (2) deleting the publish profiles, (3) deleting the hidden ".vs" folder from the solution directory, (4) running "Clean Solution" in VS, (5) deleting all "bin" and "obj" folders from the solution tree, (6) re-importing the publish profile, building, and publishing. I wish I knew which of those really affected the problem, or better yet, I wish MS would fix this bug.