MVC3 Strange error after switching on compilation of views

后端 未结 2 1534
醉梦人生
醉梦人生 2021-01-11 14:03

I am currently working on a MVC3 project with Razor. I have switchen on compilation of Views to be aware of spelling errors etc. at compile-time.

As soon as I switch

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-11 14:36

    This problem occurs when there is web project output (templated web.config or temporary publish files) in the obj folder. The ASP.NET compiler used isn't smart enough to ignore stuff in the obj folder, so it throws errors instead.

    Another fix is to nuke the publish output right before calling . Open your .csproj and change this:

    
      
    
    

    to this:

    
      
        
        
      
      
      
      
    
    

    That will delete all web.configs under \obj, as well as all PackageTmp folders under \obj.

提交回复
热议问题