相关疑难解决方法(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万
查看次数

如何将多个程序集合并为一个?

我使用EXE项目(azure应用程序的启动任务)使用我的服务堆栈,因为我已将以下服务堆栈的DLL和一些Azure的DLL复制到EXE项目中.

dll文件

当我构建这个EXE项目时,Azure DLL将与我的EXE捆绑在一起但服务堆栈的DLL不会与EXE捆绑在一起,因为要在任何机器上运行我的EXE,我需要手动复制所有服务堆栈的DLL.

我已经使用了这个服务栈的dll来使用

JsonServiceClient client = new JsonServiceClient(servicepath);
Run Code Online (Sandbox Code Playgroud)

我应该怎么做才能将所有这些DLL捆绑到我的EXE中?

c# ilmerge assemblies exe servicestack

82
推荐指数
6
解决办法
8万
查看次数

标签 统计

.net ×1

assemblies ×1

c# ×1

exe ×1

ilmerge ×1

servicestack ×1