没有为扩展名“.cshtml”注册的生成提供程序

新建的mvc4 项目,然后从其他项目里拷贝shared文件夹和_ViewStart.cshtml文件过去,然后在@符号上出现“没有为扩展名“.cshtml”注册的生成提供程序”

解决方法:

需要在项目的web.config中system.web节点里增加一项配置节点:

<compilation debug="true" targetFramework="4.0">  
  <buildProviders>  
    <add extension=".cshtml" type="System.Web.Compilation.PageBuildProvider" />  
  </buildProviders>      
</compilation>  
原文地址:https://www.cnblogs.com/war-hzl/p/6419694.html