burnandbreathe
burnandbreathe

Reputation: 73

Blazor WASM project suddenly won't publish - "Error MSB6006: "dotnet.exe" exited with code 1"

I have a Blazor WASM solution that had successfully published to a folder profile countless times. I updated VS2022 recently and suddenly the publish fails with the error output:

"C:\Program Files\dotnet\sdk\6.0.401\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(614,5): Error MSB6006: "dotnet.exe" exited with code 1"

Getting light hits on Google finding the same issue but no clear solutions. Sounds like it's possibly a bug with the latest SDK 6.0.401. I've tried implementing the global.json file in the project directory to force it to use and earlier SDK version but am getting the same error. Anybody have any ideas?

Upvotes: 3

Views: 1241

Answers (2)

Sundeep
Sundeep

Reputation: 43

I had a similar issue, but the solution was I needed to update my .NET Core Runtime version. I added verbosity to my "dotnet publish" command and found while msbuild was building a dependency there was an otherwise silent error telling me my .NET Core Runtime was out of date and gave me a link to update. Copy/paste/install and we are good to go.

Upvotes: 0

burnandbreathe
burnandbreathe

Reputation: 73

If anyone stumbles upon this having the same issue, it was that I had spaces in a folder name that my project was in. Not the folders within the project, but the Windows directory that had the project in it. Ex: \Documents\Other Projects[MyProject] - the space in "Other Projects" apparently breaks the publish. Copied the project to another folder with no spaces and it published with no issue.

Upvotes: 0

Related Questions