当我第一次启动我的网站时,我收到了这个错误
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
我究竟做错了什么?
我正在使用.NET 4并从Visual Studio启动该站点.
我最近唯一改变的是将Simple Injector(通过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, …Run Code Online (Sandbox Code Playgroud) 我前几天开发了一个针对.NET 4的应用程序,并将XCOPY安装到Windows XP机器上.我告诉机器的所有者他们需要安装.NET Framework 4来运行我的应用程序,他告诉我他做了(不是一个可靠的来源).当我运行应用程序时,我看到一个消息框,说该应用程序需要.NET Framework 4,我想安装它吗?单击是按钮将我带到Microsoft网站,稍后单击几次,安装了.NET 4,并且应用程序已成功启动.
过去,XCOPY将.NET应用程序安装到没有安装正确.NET版本的计算机上,导致应用程序在启动时崩溃,并且没有向用户显示有用的信息.这次为什么不同?
我喜欢这个功能.我想知道将来如何利用它.