简体   繁体   English

MVC中的Razor页面给出了System.Web.Helpers找不到的编译错误

[英]Razor pages in MVC are giving a compile error with System.Web.Helpers not being found

My razor view is failing to compile with the following error: 我的剃刀视图无法编译,出现以下错误:

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?)

I have System.Web.Helpers added as a reference to my project, so I am not sure what else I need to do. 我添加了System.Web.Helpers作为对我的项目的引用,所以我不确定我还需要做什么。 I have also tried a clean rebuild after adding the reference, and no change. 我在添加引用后也尝试了一个干净的重建,没有任何改变。

What am I missing? 我错过了什么?

Aha figured it out. 啊哈想出来了。 I needed to add 我需要补充一下

<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

To the <assemblies> section of web.config! 到web.config的<assemblies>部分!

Web.config line should go here: 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" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM