严重的麻烦ILMerge和.NET 4.0 [英] Serious trouble with ILMerge and .NET 4.0

查看:2107
本文介绍了严重的麻烦ILMerge和.NET 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关我的生活,我似乎无法让我的.NET 4应用程序ILMerge合并正常。即使在设置/ targetplatform,/ lib中/ NDEBUG的的添加自定义ILMerge.exe.config文件的输出文件不能正常工作(这似乎并没有能够找到合并后的图书馆)。

For the life of me, I can't seem to get my .NET 4 application merging properly with ILMerge. Even after setting /targetplatform, /lib, /ndebug and adding a custom ILMerge.exe.config file the output file doesn't work properly (it doesn't seem to be able to "find" the merged libraries).

我已经试过和的这个无济于事。我甚至不能得到它来构建,除非我用的配置文件,但是当我这样做是行不通的。如果没有配置文件,我一直得到错误信息。未解决的程序集的引用不允许的:presentationFramework

I've tried this and this to no avail. I can't even get it to build unless I use the config file, but when I do it doesn't work. Without the config file, I consistently get the error message "Unresolved assembly reference not allowed: PresentationFramework".

下面是我ILMerge命令的当前状态被用作后生成事件:

Here is the current state of my ILMerge command being used as a post build event:

ilmerge.exe /out:C:\Users\Logan\Development\Projects\OrangeNote\OrangeNote\bin\Release\OrangeNote.exe 
  /ndebug /targetplatform:v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319 
  /lib:"C:\Windows\Microsoft.NET\Framework\v4.0.30319" 
  /lib:"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies" 
  "C:\Users\Logan\Development\Projects\OrangeNote\OrangeNote\obj\Release\OrangeNote.exe" 
  "C:\Users\Logan\Development\Projects\OrangeNote\OrangeNote\..\..\..\Libraries\Lucene.Net\src\Lucene.Net\bin\Release\Lucene.Net.dll" 
  "C:\Users\Logan\Development\Projects\OrangeNote\OrangeNote\..\..\..\Libraries\Ookii.Dialogs\src\Ookii.Dialogs.Wpf\bin\Release\Ookii.Dialogs.Wpf.dll" 
  "C:\Users\Logan\Development\Projects\OrangeNote\OrangeNote\..\..\..\Libraries\SharpZipLib\bin\ICSharpCode.SharpZipLib.dll" 
  "C:\Users\Logan\Documents\Visual Studio 2010\Projects\HumanInterfaceProject\HumanInterfaceProject\bin\Release\HipLib.dll"

这是我在做什么有什么想法错了?

Any thoughts on what I'm doing wrong??

推荐答案

一个建议,我已经看到了用于组合的.dll在WPF是简单地添加DLL作为嵌入资源的项目,然后通过程序加载的dll进入装配。

One suggestion I have seen used to combine .dlls in WPF is to simply add the dll as an embedded resource the the project and then programatically load the dll into the assembly.

AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {

   String resourceName = "AssemblyLoadingAndReflection." +

      new AssemblyName(args.Name).Name + ".dll";

   using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) {

      Byte[] assemblyData = new Byte[stream.Length];

      stream.Read(assemblyData, 0, assemblyData.Length);

      return Assembly.Load(assemblyData);

   }

};

请参阅: <一href="http://blogs.msdn.com/b/microsoft_$p$pss/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx">http://blogs.msdn.com/b/microsoft_$p$pss/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx

这篇关于严重的麻烦ILMerge和.NET 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆