Precompile ASP.NET Web Pages razor (*.cshtml) files


November 2018


1.4k time


For an MVC project, there is the <MvcBuildViews>true</MvcBuildViews> property that can be set in the csproj file, see e.g. here. However, that has no effect in my Web Pages kind of project. Is there a similar switch that I could use?

Note: Typical Web Pages project is of type "Web Site", i.e. no csproj. My solution, however, uses Web Pages inside a normal Web Application project so I have csproj, it all compiles fine, runs fine, I just don't have any compile-time checking of my *.cshtml files which I'd like to add.

1 answers


Я думаю , вы должны взглянуть на RazorGenerator для реализации soultion вы хотите. Я не уверен , если он будет работать с проектом веб - сайта