代码之家  ›  专栏  ›  技术社区  ›  KallDrexx

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

  •  14
  • KallDrexx  · 技术社区  · 15 年前

    我的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: CS0234: The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
    

    我添加了System.Web.Helpers作为项目的引用,所以我不确定还需要做什么。在添加引用之后,我还尝试了一次干净的重建,但没有任何更改。

    我错过了什么?

    2 回复  |  直到 15 年前
        1
  •  30
  •   KallDrexx    15 年前

    啊哈想出来了。我需要补充

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

    <assemblies> web.config的部分!

        2
  •  3
  •   SushiGuy    12 年前

    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" />