dotnet.exe exited with code 1

Prathamesh Shende 376 Reputation points

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

I m getting this error on publish the project of blazor web assembly project

I tried by deleting bin and obj folder but did not work.
I am using VS 2022 17.2.5

How I can resolve this ?

A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,325 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Zhi Lv - MSFT 29,986 Reputation points Microsoft Vendor

    Hi @Prathamesh Shende ,

    It seems that this is a known issue: Failure to publish WASM when project source path contains blank spaces - Post-upgrade VS 2022 to 17.2.4 #26061.

    And the issue might relate to the location of your project, the path might contain the blank spaces, try to remove the blank spaces, or change the project location to the path without blank spaces.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    1 person found this answer helpful.
    0 comments No comments

  2. Othusitse Seth Dylan Phefo 1 Reputation point

    Try the following

    Solution 1
    This could happen if you don't have the correct framework installed. Go to to get the latest framework.

    Solution 2
    It turns out that if there are no files output in the target bin\Debug\netcoreapp2.1 path, the process just quit. So make sure to re-enable (check) the Build option for that project in the Configuration Manager so that all project assemblies are built to generate output files that runs the project.

    I cant guarantee you that they will run but try them

    0 comments No comments

  3. Prathamesh Shende 376 Reputation points

    it's not working, is there any other way to fix this?

    0 comments No comments