Reputation: 2986
I'm using visual 2019, ASP.NET MVC core 2.2.0
My project debug ok, build no error but when I publish it give me an error like this
Detail file in AppData\Local\Temp\tmp76C2.tmp
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.<---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
How can I fix it?
Upvotes: 12
Views: 18480
Reputation: 71
Changed the Framework version from 4.5.2 to 4.6.1 and it worked.
The question might be a bit old but it might help someone.
Upvotes: 1
Reputation: 396
I encountered this problem in Visual Studio 2022 when try to publish Blazor project. I tried many things (Clean, Rebuild, clear Nuget Cache etc) but nothing worked. Finally I used this command on the solution folder with Powershell (run as Admin)
dotnet workload install wasm-tools
Then I reopened Visual Studio and publish worked
Edit: I have same issues when try to publish Blazor projects. Instead of the workaround above, I delete the current publish profile and create a new one. And it publishes successfully!
Upvotes: 2
Reputation: 124
This may be helpful for someone else. I got below error while publishing the code. Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
We upgraded .Net core 5.0 to 6.0 (VS 2022) and trying to provide new build to higher environments. After spending little time around the error in output window and logs (published by Visual Studio) i found publish profile(FolderProfile.pubxml) of our project is targeting to .Net 5.0 where is our project now upgraded to .NET 6.0 hence the publish was unsuccessful. Modified tag in FolderProfile.pubxml
<TargetFramework>net6.0</TargetFramework>
Upvotes: 1
Reputation: 466
I have also encountered this problem when I was going to publish my API.After that, I found my publishing folder does not exist in my local PC.
Upvotes: 1
Reputation: 203
Check out the output window of visual studio when publishing, read all lines to find any error, then fix it. For example it might be a problem for copying files to publish folder after building. So you won't get any error on build as well.
Upvotes: 8
Reputation: 41
It could also be due to a problem with the signature in your deployment options. Make sure to select a valid certificate.
Upvotes: 0
Reputation: 742
For me the problem was that I updated de .net core version (2.2 to 5) of my project and forgot to change the .net version target on my publish profile.
Upvotes: 6
Reputation: 730
I ran into this error in VS 2019/Core 3.1. In my case, the Publish displayed a bunch of errors with the Bundler, which a regular build didn't show. Eventually found the Web Publish Activity window gave a clue: it shows line numbers for errors it finds, and the first error with the Bundler there was the problem, apparently. Turned out it didn't like an async function in the JS file. I removed that and it published OK.
Upvotes: 3