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.
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
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.
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.
http://slkjfdf.net/ - Umasae <a href="http://slkjfdf.net/">Anomia</a> qlz.wavf.ernestech.com.mnx.ql http://slkjfdf.net/
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.
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
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.
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.
Also make sure that all projects included in the same Solution has the same Target Framework, differences in those projects might cause this error.
http://slkjfdf.net/ - Otahirr <a href="http://slkjfdf.net/">Axojagub</a> qaj.atvu.ernestech.com.wnq.ev http://slkjfdf.net/