C# MVC中的Razor页面出现编译错误,找不到System.Web.Helpers
My razor视图无法编译,出现以下错误:C# MVC中的Razor页面出现编译错误,找不到System.Web.Helpers,c#,asp.net-mvc,razor,C#,Asp.net Mvc,Razor,My razor视图无法编译,出现以下错误: Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS023
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
我添加了System.Web.Helpers作为项目的参考,因此我不确定还需要做什么。在添加引用后,我还尝试了一次干净的重建,没有任何更改
我错过了什么?啊哈明白了。我需要补充一点
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
转到web.config的
部分 Web.config行应该在这里:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
此项目是从以前版本的MVC升级而来的吗?您能告诉我它是如何自动添加到web配置文件中的吗?我在web.config中没有看到程序集
部分。有样本文件吗?把这行放在下面