无法从程序集的mcorlib加载类型‘System.Runtime.CompilerServices.ExtensionAttribute’当我第一次启动我的网站时,我收到了这个错误Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'我做错什么了?我正在使用.NET 4,并从VisualStudio启动该站点。我最近唯一改变的是在我的项目中添加简单的注入器(通过Nuget)。这是堆栈跟踪[TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.] System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +115
3 回答
噜噜哒
TA贡献1784条经验 获得超7个赞
慕少森
TA贡献2019条经验 获得超9个赞
packages.config (before):<?xml version="1.0" encoding="utf-8"?><packages> <package id="AutoMapper" version="3.1.0" targetFramework="net45" /> <package id="EntityFramework" version="5.0.0" targetFramework="net45" /> <package id="Microsoft.AspNet.WebApi.Client" version="5.0.0" targetFramework="net45" /> <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" /></packages>
packages.config (after):<?xml version="1.0" encoding="utf-8"?><packages> <package id="AutoMapper" version="3.1.1" targetFramework="net40" /> <package id="EntityFramework" version="6.0.2" targetFramework="net40" /> <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" /> <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" /> <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" /></packages>
- 3 回答
- 0 关注
- 540 浏览
添加回答
举报
0/150
提交
取消