Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build failed. Check the Output window for more details - C# publishing fails but build succeeds

I am trying to publish a web application on Visual Studio 2017. The build succeeds but the publishing fails. When it fails an error dialog comes up which says "Publish has encountered an error. Build Failed. A diagnostic log has been written to the following location: .."

This is what the file with the log contains:

System.AggregateException: One or more errors occurred. ---> System.Exception: Build failed. Check the Output window for more details. --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass41_0.<PublishAsync>b__2() at System.Threading.Tasks.Task``1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__116.MoveNext() ---> (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.

I've tried running the application as Admin but it still doesn't work. I also searched for the Microsoft.Net.Compilers reference but it's not in my project.

like image 519
ayyyeee Avatar asked Jul 27 '18 22:07

ayyyeee


2 Answers

Make sure Build + Intellisense is selected, not just Build Only. That way you can see other errors that might be hiding out there.

enter image description here

like image 185
live-love Avatar answered Sep 19 '22 02:09

live-love


Try open visual studio as admin.

like image 44
odelgadillo Avatar answered Sep 18 '22 02:09

odelgadillo