Compile Views in ASP.NET MVC

前端 未结 8 1267
故里飘歌
故里飘歌 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:00

    You can use aspnet_compiler for this:

    C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -v /Virtual/Application/Path/Or/Path/In/IIS/Metabase -p C:\Path\To\Your\WebProject -f -errorstack C:\Where\To\Put\Compiled\Site
    

    where "/Virtual/Application/Path/Or/Path/In/IIS/Metabase" is something like this: "/MyApp" or "/lm/w3svc2/1/root/"

    Also there is a AspNetCompiler Task on MSDN, showing how to integrate aspnet_compiler with MSBuild:

    
        
            
        
    
    

提交回复
热议问题