新建的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>
05-12 09:51