title: Build failed. Check the Output window for more details - C# publishing fails but build succeeds
body: <p>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: .."</p>
  
  <p>This is what the file with the log contains: </p>
  
  <p><code>System.AggregateException: One or more errors occurred. ---&gt; 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.&lt;&gt;c__DisplayClass41_0.&lt;PublishAsync&gt;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.&lt;RunPublishTaskAsync&gt;d__116.MoveNext()
  ---&gt; (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.</code></p>
  
  <p>I've tried running the application as Admin but it still doesn't work. I also searched for the <strong>Microsoft.Net.Compilers</strong> reference but it's not in my project. </p>