1

From VS 2017 what I tried:

  1. Build in release mode & debug mode both builds fine.
  2. Set Build verbosity to Diagnostic, there is not much information indicating code error.

However .tmp dump file indicates some error. I suspect these are visual studio internal errors:

5/4/2018 9:34:44 PM
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.<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__88.MoveNext()
---> (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<---

===================
Abhijeet
  • 13,006
  • 26
  • 83
  • 159

2 Answers2

1

Setting RazorCompileOnBuild property to true should resolve your problem.

Take a look on following question

pacifica
  • 26
  • 3
0

Had to set build verbosity to diagnostics then found out there were some errors in un-used Razor view pages.

There must be a way to compile Razor during build time rather than when publishing.

Abhijeet
  • 13,006
  • 26
  • 83
  • 159