简体   繁体   English

如何将第三方dll与自己的dll结合起来

[英]how to combine 3rd party dll with own dll

I'm creating a library TRSetup.dll in C#. 我在C#中创建了一个库TRSetup.dll。 The project include some third party dll. 该项目包括一些第三方DLL。 (eg: GalaSoft.MvvmLight.Extras.WPF4.dll, GalaSoft.MvvmLight.WPF4.dll, RemObjects.Hydra.dll) (例如:GalaSoft.MvvmLight.Extras.WPF4.dll,GalaSoft.MvvmLight.WPF4.dll,RemObjects.Hydra.dll)

I need to combine all the dll and create a single dll. 我需要结合所有的DLL并创建一个单独的DLL。

I'm using ilMerge to combine the dll. 我正在使用ilMerge来组合dll。 The following command I'm using, 我正在使用以下命令,

    ilMerge /out:MergedSetup.dll /targetplatform:v4,"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client" 
/lib: TRSetup.dll  Galasoft.MvvmLight.Extras.WPF4.dll Galasoft.MvvmLight.WPF4.dll RemObject.Hydra.dll

I can create a dll with the name MergedSetup.dll, But in runtime it is crashing. 我可以创建一个名为MergedSetup.dll的DLL,但在运行时它崩溃了。 How shall I merge these dll. 我该如何合并这些dll。

Thank you in advance. 先感谢您。

That's know problem with WPF (and NHibernate, and many others which reference assembly by name) and ILMerge. WPF(以及NHibernate,以及许多其他引用按名称汇编的程序)和ILMerge的问题。 Long story short after ILMerge there is no such assembly anymore, they all get injected into main assembly. 在ILMerge之后很长一段时间没有这样的装配,它们都被注入主装配。

Try embedding instead of merging: LibZ ( http://libz.codeplex.com/ ) or Costura.Fody ( https://github.com/Fody/Costura/ ) 尝试嵌入而不是合并:LibZ( http://libz.codeplex.com/ )或Costura.Fody( https://github.com/Fody/Costura/

Disclaimer: I'm the author of LibZ. 免责声明:我是LibZ的作者。

Cheers, 干杯,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM