Share via

ASP.NET Web API Publish Fails with Build failed. Check the Output window for more details

Essama Official 0 Reputation points
2026-02-26T18:22:05.7066667+00:00

I am trying to publish my ASP.NET Web API project, but the publish process fails with the following error:

2/26/2026 12:33:17 PM  

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.\<---  

The publish operation stops immediately and does not provide detailed information in the publish window. The only message displayed is:

Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed.

Check the Output window for more details.

In the console : VSMSDeploy: Publish failed to deploy.

    : Output Property: _PublishResult=False

    Done executing task "VSMSDeploy" -- FAILED.

    Done building target "MSDeployPublish" in project "Orbis.Web.Api.csproj" -- FAILED.

Done building project "Orbis.Web.Api.csproj" -- FAILED.

I have checked:

  • The error list window
  • The output window
  • Cleaned and rebuilt the solution
  • Restarted Visual Studio
  • Created a new web

However, I still cannot identify the exact cause of the build failure.

I'm on .net 9.

Has anyone experienced this issue before?

What are the possible reasons for this error during publishing, and how can I get more detailed diagnostics to fix it?

Thank you for your help.

Screenshot (53)

Screenshot (54)

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Essama Official 0 Reputation points
    2026-03-04T07:38:38.1933333+00:00

    Hello, were you able to find a solution?

    0 comments No comments

  2. Essama Official 0 Reputation points
    2026-02-27T08:41:51.94+00:00

    Thank you for your support.

    Regarding the publish.binlog, I generated the file as instructed, but I could not find any errors (please see the attached screenshot). I also checked the tree structure in MSBuild Structured Log Viewer, but I may not be searching in the correct place.

    For publishing, I am using Azure App Service, not IIS, so I did not change anything related to IIS configuration.

    I have already tried the following steps multiple times:

    Deleted and recreated the publish profile

    Created a completely new Azure App Service

    Deleted the bin, obj, and .vs folders

    Verified that the App Service is running

    Checked that the RuntimeIdentifier is compatible

    Despite all these attempts, the publication still fails.

    Screenshot (55)

    Screenshot (56)

    Screenshot (57)

    Screenshot (58)

    Screenshot (59)

    0 comments No comments

  3. Siddhesh Desai 3,860 Reputation points Microsoft External Staff Moderator
    2026-02-27T01:53:22.9+00:00

    Hi @Essama Official

    Thank you for reaching out to Microsoft Q&A.

    This issue occurs because the Visual Studio Publish pipeline fails during the MSDeploy (Web Deploy) stage, even though the project may build successfully. When you publish an ASP.NET Web API project, Visual Studio runs additional MSBuild targets beyond a normal build, such as computing publish assets, transforming configuration files, and deploying via Web Deploy (MSDeploy). If any of these steps fail, Visual Studio often throws a generic exception (Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed) without surfacing the actual root cause in the Publish window. This is why you do not see meaningful errors in the Error List or standard Output window. In most cases, the real issue is related to Web Deploy connectivity, publish profile configuration, missing or corrupted Web Deploy components, or publish-time MSBuild tasks that do not run during a normal build, especially when using newer SDKs like .NET 9.

    Refer below points to resolve this issue or as a workaround

    1. Enable detailed diagnostics to identify the real error

    The publish UI hides the underlying MSBuild or MSDeploy failure. Running publish from the command line with diagnostic logging exposes the exact failing task.

    dotnet publish Orbis.Web.Api.csproj -c Release -v:diag -bl:publish.binlog
    

    Open the generated publish.binlog using MSBuild Structured Log Viewer and look for the first actual error (for example, MSDeploy connection errors, missing targets, or asset computation failures).

    2. Verify Web Deploy (MSDeploy) installation and services If the failure occurs in the MSDeployPublish target, the issue is often with Web Deploy itself.

    • Ensure Web Deploy 3.6+ is installed on the target machine/server.
    • Ensure Web Management Service (WMSVC) is installed and running.
    • Restart the services if needed:
    net stop wmsvc
    net start wmsvc
    net stop msdepsvc
    net start msdepsvc
    

    If Web Deploy was installed before IIS Management Tools, reinstalling Web Deploy can resolve silent failures.

    3. Validate publish profile and deployment method Incorrect or outdated publish profiles can cause publish-time failures.

    • Recreate the publish profile in Visual Studio.
    • If publishing to IIS or Azure App Service, confirm the correct endpoint, credentials, and deployment type (MSDeploy vs Zip Deploy).
    • As a test, try Folder publish. If folder publish works, the issue is isolated to MSDeploy rather than the application build.

    4. Check Output window configuration in Visual Studio Some publish errors only appear in a specific output mode.

    • Go to View → Output
    • Set Show output from to Build + IntelliSense (not just Build) This can reveal hidden MSBuild or publish-time errors.

    5. Clean cached build artifacts and Visual Studio state Corrupted intermediate files can cause publish failures.

    • Close Visual Studio
    • Delete the following folders:
      • bin
        • obj
          • .vs
          • Reopen the solution, rebuild, and publish again.

    6. Review publish-time configuration and runtime settings Publish runs extra steps that a normal build does not.

    • Ensure RuntimeIdentifier, PlatformTarget, and publish profile settings are compatible (for example, avoid mismatches like win-x64 with x86).
    • Temporarily disable advanced options such as trimming, single-file, or AOT if enabled, and retry publish.If Web Deploy was installed before IIS Management Tools, reinstalling Web Deploy can resolve silent failures.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.