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