Wednesday, October 18, 2017

VS 2017 MVC Core 2.0 error - Cannot find reference assembly 'Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe' file for package Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86

Scenario

After compiling a MVC Core 2.0 project in VS 2017, the browser isn't displaying the site

Error
An unhandled exception occurred while processing the request.

Cannot find reference assembly 'Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe' file for package Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86

Solution
Open the .csproj file in a text editor
In the section set the MvcRazorCompileOnPublish tag as true:
      <mvcrazorcompileonpublish>true</mvcrazorcompileonpublish>

2 comments: