相关疑难解决方法(0)

无法从程序集'mscorlib加载类型'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并从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

142
推荐指数
4
解决办法
16万
查看次数

为什么我的.NET 4应用程序知道没有安装.NET 4

我前几天开发了一个针对.NET 4的应用程序,并将XCOPY安装到Windows XP机器上.我告诉机器的所有者他们需要安装.NET Framework 4来运行我的应用程序,他告诉我他做了(不是一个可靠的来源).当我运行应用程序时,我看到一个消息框,说该应用程序需要.NET Framework 4,我想安装它吗?单击是按钮将我带到Microsoft网站,稍后单击几次,安装了.NET 4,并且应用程序已成功启动.

过去,XCOPY将.NET应用程序安装到没有安装正确.NET版本的计算机上,导致应用程序在启动时崩溃,并且没有向用户显示有用的信息.这次为什么不同?

  1. 它是否内置于我的应用程序中,因为我针对.NET X?
  2. 它是否已经安装在目标机器上?

我喜欢这个功能.我想知道将来如何利用它.

.net c# xcopy .net-4.0

25
推荐指数
1
解决办法
2174
查看次数

标签 统计

.net ×2

.net-4.0 ×1

c# ×1

xcopy ×1