Asp.net-mvc – A diagnostic log has been written to the following location

asp.net-mvcpublishingvisual studioweb-hosting

I´m getting this error when I try to publish an Asp.Net MVC project to a web-hosting:

A diagnostic log has been written to the following location: C:\Users\MyUser\AppData\Local\Temp…

I´m using Visual Studio 2017 and in order to publish the project, I downloaded the PublishSettings from the hosting.

The .Net version is 4.6.1.

The log says that the publish failed due to build errors, but I see no build errors when I compile the solution. This is the log:

6/5/2018 11:39:20 AM System.AggregateException: One or more errors
occurred. —> System.Exception: Publish failed due to build errors.
Check the error list 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__DisplayClass40_0.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.d__108.MoveNext()
—> (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<—

===================

Best Answer

This happens when you have files seen in Solution Explorer(with yellow warning icon) but not exist in the project folder.

  • Check your project folder add not existing files or delete them from solution explorer
  • Check the "Output window", you will see problematic files.
  • Delete temp files in AppData/Local/Temp
Related Topic