Compile Views in ASP.NET MVC

前端 未结 8 1356
故里飘歌
故里飘歌 2020-11-22 02:54

I want an msbuild task to compile the views so I can see if there are compile time errors at well... compile time. Any ideas?

8条回答
  •  滥情空心
    2020-11-22 03:17

    From the readme word doc for RC1 (not indexed by google)

    ASP.NET Compiler Post-Build Step

    Currently, errors within a view file are not detected until run time. To let you detect these errors at compile time, ASP.NET MVC projects now include an MvcBuildViews property, which is disabled by default. To enable this property, open the project file and set the MvcBuildViews property to true, as shown in the following example:

    
      
        true
      
    

    Note Enabling this feature adds some overhead to the build time.

    You can update projects that were created with previous releases of MVC to include build-time validation of views by performing the following steps:

    1. Open the project file in a text editor.
    2. Add the following element under the top-most element: true
    3. At the end of the project file, uncomment the element and modify it to match the following:
    
        
    
    

提交回复
热议问题