Linker 在使用<;时使用mono mkbundle工具创建静态编译的二进制文件;绑定重定向>;

Linker 在使用<;时使用mono mkbundle工具创建静态编译的二进制文件;绑定重定向>;,linker,mono,mkbundle,Linker,Mono,Mkbundle,我试图使用mkbundle生成一个静态编译的二进制文件,但是当涉及到在配置文件中使用的依赖项时,我遇到了问题 如果提供了--deps选项,mkbundle将尝试加载引用的程序集,但找不到在运行时根据app.config中的bindingRedirect重定向的引用 使用mkbundle时,处理依赖项的正确方法是什么 命令: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly '

我试图使用mkbundle生成一个静态编译的二进制文件,但是当涉及到在配置文件中使用
的依赖项时,我遇到了问题

如果提供了--deps选项,mkbundle将尝试加载引用的程序集,但找不到在运行时根据app.config中的bindingRedirect重定向的引用

使用mkbundle时,处理依赖项的正确方法是什么

命令:

Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) <0x7f1dd3d2e470 + 0x000a2> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string,System.Security.Policy.Evidence,bool)
  at System.Reflection.Assembly.ReflectionOnlyLoad (System.String assemblyString) <0x7f1dd3da1960 + 0x00022> in <filename unknown>:0 
  at IKVM.Reflection.Universe.DefaultResolver (System.String refname, Boolean throwOnError) <0x404a4590 + 0x0007e> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, Boolean throwOnError) <0x404a3b20 + 0x00087> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname) <0x404a3af0 + 0x0001b> in <filename unknown>:0 
  at MakeBundle.QueueAssembly (System.Collections.Generic.List`1 files, System.String codebase) <0x404b1590 + 0x001eb> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) <0x7f1dd3d2e470 + 0x000a2> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string,System.Security.Policy.Evidence,bool)
  at System.Reflection.Assembly.ReflectionOnlyLoad (System.String assemblyString) <0x7f1dd3da1960 + 0x00022> in <filename unknown>:0 
  at IKVM.Reflection.Universe.DefaultResolver (System.String refname, Boolean throwOnError) <0x404a4590 + 0x0007e> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, Boolean throwOnError) <0x404a3b20 + 0x00087> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname) <0x404a3af0 + 0x0001b> in <filename unknown>:0 
  at MakeBundle.QueueAssembly (System.Collections.Generic.List`1 files, System.String codebase) <0x404b1590 + 0x001eb> in <filename unknown>:0
OS is: Linux
Note that statically linking the LGPL Mono runtime has more licensing restrictions than dynamically linking.
See http://www.mono-project.com/Licensing for details on licensing.
Sources: 21 Auto-dependencies: False
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.Gateway.exe
config from: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.Gateway.exe.config
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.Cache.Redis.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.MassTransit.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.Nancy.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName2.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.Service.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Magnum.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MassTransit.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MassTransit.Transports.RabbitMq.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MongoDB.Bson.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MongoDB.Driver.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Nancy.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Nancy.Hosting.Self.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Newtonsoft.Json.dll
   embedding: /usr/lib/mono/gac/RabbitMQ.Client/4.0.0.0__b03f5f7f11d50a3a/RabbitMQ.Client.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Common.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Interfaces.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Redis.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Text.dll
Compiling:
as -o temp.o temp.s 
cc -o newbin -Wall `pkg-config --cflags mono-2` temp.c  `pkg-config --libs-only-L mono-2` -Wl,-Bstatic -lmono-2.0 -Wl,-Bdynamic `pkg-config --libs-only-l mono-2 | sed -e "s/\-lmono-2.0 //"` temp.o
temp.c: In function ‘install_dll_config_files’:
temp.c:77:2: warning: pointer targets in passing argument 2 of ‘mono_register_config_for_assembly’ differ in signedness [-Wpointer-sign]
  mono_register_config_for_assembly ("Integrate.ServiceName.Gateway.exe", assembly_config_Integrate_ServiceName_Gateway_exe);
  ^
In file included from temp.c:2:0:
/usr/lib/pkgconfig/../../include/mono-2.0/mono/metadata/assembly.h:102:24: note: expected ‘const char *’ but argument is of type ‘const unsigned char *’
MONO_API void          mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);
                        ^
Done
user@user-lubuntu:mkbundle--deps--static Integrate.ServiceName.Gateway.exe*.dll-o newbin

结果:

Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) <0x7f1dd3d2e470 + 0x000a2> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string,System.Security.Policy.Evidence,bool)
  at System.Reflection.Assembly.ReflectionOnlyLoad (System.String assemblyString) <0x7f1dd3da1960 + 0x00022> in <filename unknown>:0 
  at IKVM.Reflection.Universe.DefaultResolver (System.String refname, Boolean throwOnError) <0x404a4590 + 0x0007e> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, Boolean throwOnError) <0x404a3b20 + 0x00087> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname) <0x404a3af0 + 0x0001b> in <filename unknown>:0 
  at MakeBundle.QueueAssembly (System.Collections.Generic.List`1 files, System.String codebase) <0x404b1590 + 0x001eb> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) <0x7f1dd3d2e470 + 0x000a2> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string,System.Security.Policy.Evidence,bool)
  at System.Reflection.Assembly.ReflectionOnlyLoad (System.String assemblyString) <0x7f1dd3da1960 + 0x00022> in <filename unknown>:0 
  at IKVM.Reflection.Universe.DefaultResolver (System.String refname, Boolean throwOnError) <0x404a4590 + 0x0007e> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, Boolean throwOnError) <0x404a3b20 + 0x00087> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname) <0x404a3af0 + 0x0001b> in <filename unknown>:0 
  at MakeBundle.QueueAssembly (System.Collections.Generic.List`1 files, System.String codebase) <0x404b1590 + 0x001eb> in <filename unknown>:0
OS is: Linux
Note that statically linking the LGPL Mono runtime has more licensing restrictions than dynamically linking.
See http://www.mono-project.com/Licensing for details on licensing.
Sources: 21 Auto-dependencies: False
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.Gateway.exe
config from: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.Gateway.exe.config
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.Cache.Redis.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.MassTransit.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.Nancy.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName2.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Integrate.ServiceName.Service.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Magnum.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MassTransit.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MassTransit.Transports.RabbitMq.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MongoDB.Bson.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/MongoDB.Driver.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Nancy.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Nancy.Hosting.Self.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/Newtonsoft.Json.dll
   embedding: /usr/lib/mono/gac/RabbitMQ.Client/4.0.0.0__b03f5f7f11d50a3a/RabbitMQ.Client.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Common.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Interfaces.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Redis.dll
   embedding: /media/sf_Share/dev/builder/Integrate.ServiceName.Gateway/bin/Debug/ServiceStack.Text.dll
Compiling:
as -o temp.o temp.s 
cc -o newbin -Wall `pkg-config --cflags mono-2` temp.c  `pkg-config --libs-only-L mono-2` -Wl,-Bstatic -lmono-2.0 -Wl,-Bdynamic `pkg-config --libs-only-l mono-2 | sed -e "s/\-lmono-2.0 //"` temp.o
temp.c: In function ‘install_dll_config_files’:
temp.c:77:2: warning: pointer targets in passing argument 2 of ‘mono_register_config_for_assembly’ differ in signedness [-Wpointer-sign]
  mono_register_config_for_assembly ("Integrate.ServiceName.Gateway.exe", assembly_config_Integrate_ServiceName_Gateway_exe);
  ^
In file included from temp.c:2:0:
/usr/lib/pkgconfig/../../include/mono-2.0/mono/metadata/assembly.h:102:24: note: expected ‘const char *’ but argument is of type ‘const unsigned char *’
MONO_API void          mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);
                        ^
Done
user@user-卢本图:/纽宾

创建服务总线期间引发异常
位于:0中的MassTransit.ServiceBusFactory.New(System.Action`1配置)
在0中的Integrate.masstTransit.ServiceBootstrapper.Initialize(System.String queueEndpoint)处
位于0中的Integrate.ServiceName.Bootstrapper.ConfigureServiceBus(Nancy.TinyIoc.TinyIoCContainer iocContainer)
在0中的Integrate.ServiceName.Bootstrapper.ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer iocContainer,IPipelines管道)处
位于Nancy.Bootstrapper.NancyBootTrapperBase`1[TContainer]。在0中初始化()
位于Nancy.Hosting.Self.NancyHost..ctor(INancyBootstrapper引导程序,Nancy.Hosting.Self.HostConfiguration配置,System.Uri[]BaseURI),位于:0
在0中的Integrate.ServiceName.Program.Main(System.String[]args)处