ASP.Net MVC MvcBuildViews increasing compile time drastically

后端 未结 1 1269
北荒
北荒 2021-02-14 19:19

We have a project and would like to build the views to generate compile time errors if there is anything wrong within the Views\' .cshtml files.

Still, compile time incr

相关标签:
1条回答
  • 2021-02-14 20:21

    Well I think having the possibility to compile the views is a good thing by itself but I cannot wait that long either. So what I prefer to do is to add that MvcBuildViews = true inside the ProperyGroup of Release so that you only Compile the views at the Release time and before deployment

    The property group should look like this:

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
    

    So put your

    <MvcBuildViews>true</MvcBuildViews>
    

    Inside this Release block. this way you still compile your views once and not every time you try to debug...

    0 讨论(0)
提交回复
热议问题