运行时编译错误来自Microsoft.AspNet.WebApi.HelpPage版本4.0.30506

 姑另静乖_606 发布于 2023-02-12 17:45

当我尝试使用版本4.0.30506(不幸的是我们现在绑定到此版本的ASP.NEt Web API)的Microsoft.AspNet.WebApi.HelpPage nuget包时,我收到以下错误.我使用的是Windows 7和.NET 4.5.

Compilation 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: CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Source Error:


Line 11: 
Line 12:     // Group APIs by controller
Line 13:     ILookup apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor.ControllerName);
Line 14: }
Line 15: 

在此输入图像描述

据我所知,我有所有正确的参考资料.我已经尝试过寻找一个System.Runtime程序集,但我在我的系统上找不到它.我已将index语句添加到Index.cshtml的顶部,但没有任何影响.

@using System
@using System.Runtime

有什么原因造成这个错误吗?

1 个回答
  • 检查你的web.config:

    <compilation debug="true" targetFramework="4.5">
        <assemblies>
            <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </assemblies>
    </compilation>
    

    2023-02-12 17:47 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有