Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details

Microsoft Web Tools Shared Exceptions Web Tools Exception (Check the Output window for more details)Click to Watch Video

Question: How do you resolve Visual Studio Error When Publishing: Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.

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



Please Login to see the rest of the answer

Answer: This error happens when there have been current updates to Visual Studio 2019 at least to my knowledge. When I experienced this error, I had other applications in the Solution, it looks like Visual Studio experiences problems building those other projects included in the same Solution.

If you need to read more about your specific project scenario, check the output window in Visual Studio for error details.

This is helpful in diagnosing the issue, for example, the error logged into the OutPut Console (Build + IntelliSense) might say " The RuntimeIdentifier platform 'win-x64' and the PlatformTarget 'X86' must be compatible" then you will know that you need to have the same platform in both the PlatformTarget and Publish profile.

To resolve this error, follow the steps below:

1. Stop or Cancel Building the application if the build is stuck.
2. Make sure you save your changes 
3. Close Visual Studio and open your project again.
4. When the project loads into Visual Studio 2019, Clean the Solution
4. Then build the solution
5. After building the solution, go ahead and publish if you need to.


Write an Article

Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details

Edited Version 2

 Check to see if you have multiple appsettings.json in Class Library. This is common when you have a DataLayer Class Library that has ORM or Data Access Layer, avoid including app settings in Class Library unless if you really need it.

If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

DuDu said:

Hey guys, for me this issue was due to using Visual Studio 2022 for the project created in Visual Studio 2019. When I switched to building my project with Visual Studio 2019 the error went away.

anonymous said:

Make sure Build + Intellisense is selected, not just Build Only. That way you can see other errors that might be hiding out there. https://i.stack.imgur.com/r6hAa.png

Luke said:

Hello Team, another issue I found that triggered this error is when you have multiple output files with the same relative paths in different other Projects that are referenced in the main project. Correct this by only having one "publish output" in the Main Project you are trying to publish. Avoid having to Publish the output path in Class Libraries.

Andrew (C# Developer) said:

The problem in my case was due to errors in another project that I referenced. The error did not appear in the Diagnostic Error Log Window unless I toggled the "Built + Intellisense" that is why I noticed the project causing the error.

Josh said:

Also make sure that all projects included in the same Solution has the same Target Framework, differences in those projects might cause this error.


© 2022 - ErnesTech - Privacy