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

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


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


Solution: 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.
Keep in mind that the way you find out about the Error itself is by navigating to the Error List in the Output Window of Visual Studio. If you are using VS Code, find out where you see the logs for the Builds. See the image below if you are using Visual Studio.
Found Multiple Publish files with the same relative path

If you find out that the error says "Found multiple output files with the same relative paths" then just add the line of code below to the PublishProfile.puxml

<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>



Otherwise, 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.

If the above did not help you, then try the following 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.


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.




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.

Posted On: January 10, 2022 21:25:09 PM
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.

Posted On: November 12, 2021 19:08:05 PM
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.

Posted On: September 30, 2021 17:34:28 PM
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.

Posted On: September 30, 2021 17:29:25 PM


For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]