当我尝试使用4.0.30506版的Microsoft.AspNet.WebApi.HelpPage nuget包(不幸的是,我们现在绑定到这个版本的nuget包)时,我得到了以下错误。我使用的是Windows7和.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<string, ApiDescription> apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor.ControllerName);
Line 14: }
Line 15:
据我所知,我有所有正确的参考资料。我试着按照提示查找System.Runtime程序集,但在我的系统上找不到它。我已经在Index.cshtml的顶部添加了using语句,但没有任何影响。
@using System
@using System.Runtime
有什么建议是导致这个错误的吗?
发布于 2013-12-05 18:39:16
检查您的web.config:
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
https://stackoverflow.com/questions/20397623
复制相似问题