Web api help page error CS0012: Type "System.Collections.Generic.Dictionary'2错误

2021-04-03 03:27

阅读:726

标签:view   出现   iis   you   .com   ons   编译   bapi   render   

1、在asp.net Boilerplate项目中,Abp.0.12.0.2,.net framework4.5.2。下载后添加了webApi的helpPage功能,调试出现错误。

dubug : at Areas\HelpPage\Views\Help\DisplayTemplatesHelpPageApiModel.cshtml Samples error:
D:\ project \MyWeb\MyWeb.Web\Areas\HelpPage\Views\Help\DisplayTemplates\Samples.cshtml (6): error CS0012: Type "System.Collections.Generic.Dictionary‘2 " defined in the Assembly that is not referenced. You must add the assemblies "System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" reference.

解决方法:在 Web.config, node , adding

解决:http://www.lyalin.com/2014/04/25/the-type-system-object-is-defined-in-an-assembly-that-is-not-reference-mvc-pcl-issue/ 

2、还是1的项目,debug时候正常,但发布到iis时候出现错误:

编译错误

说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 

编译器错误消息: CS0012: 类型“System.Object”在未被引用的程序集中定义。必须添加对程序集“System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”的引用。

 

解决方法:在web.config中,node , adding

效果:

system.web>
    
    globalization culture="auto" uiCulture="auto"/>
    compilation debug="true" targetFramework="4.5.2">
      assemblies>
        add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        add assembly="System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      assemblies>
    compilation>
     
    httpRuntime/>
    customErrors mode="Off"/>
    pages controlRenderingCompatibilityVersion="4.0"/>
  system.web>

 

Web api help page error CS0012: Type "System.Collections.Generic.Dictionary'2错误

标签:view   出现   iis   you   .com   ons   编译   bapi   render   

原文地址:https://www.cnblogs.com/lenmom/p/9209242.html


评论


亲,登录后才可以留言!