ILMerge 使用 .NET 4.5

ILMerge

Using .NET 4.5

If you are trying to use ILMerge with .NET 4.5, you should read this helpful post by Matt Wrock!

A Great Alternative to using ILMerge
If you cannot use ILMerge because you are trying to merge WPF assemblies, then here is a great way for you to get the same effect, courtesy of Jeffrey Richter: embed the dlls you want to merge as resources and load them on demand! In many ways, this is a better technique than using ILMerge, so I strongly urge you to check it out, even if ILMerge is working for your scenario.

Using ILMerge with v4.0

ILMerge should work just fine with newer versions of .NET. Just use the option: /targetplatform:v4,<path to your v4 framework directory>. For version 3.5, you probably don’t need to set the target platform, but you may need to add the v3.5 framework directory as a /lib option so that assemblies from there can be found. (Unless they’re in the GAC in which case they’ll be found anyway.) To run ILMerge in the v4.0 runtime, use this config file.

Merging WPF assemblies

ILMerge is not able to merge WPF assemblies. They contain resources with encoded assembly identities. ILMerge is unable to deserialize the resources, modify the assembly identities, and then re-serialize them. Sorry!

ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. It is freely available for use from the Tools & Utilities page at the Microsoft .NET Framework Developer Center.

You can also get it via NuGet. Rob Reynolds wrote a chocolately nuget for ILMerge.

If you have any problems using it, please get in touch. (mbarnett _at_ microsoft _dot_ com)

ILMerge takes a set of input assemblies and merges them into one target assembly. The first assembly in the list of input assemblies is the primary assembly. When the primary assembly is an executable, then the target assembly is created as an executable with the same entry point as the primary assembly. Also, if the primary assembly has a strong name, and a .snk file is provided, then the target assembly is re-signed with the specified key so that it also has a strong name.

ILMerge is packaged as a console application. But all of its functionality is also available programmatically.

There are several options that control the behavior of ILMerge. See the documentation that comes with the tool for details.

The current version is 2.11.1103 (created on 3 November 2011). NOTE: There is no longer a version of ILMerge that runs in the v1.1 runtime.

The v2.0 version of ILMerge runs in the v2.0 .NET Runtime, but it is also able to merge v1 or v1.1 assemblies. However, it can merge PDB files only for v2 (and later) assemblies.

The v2 version of ILMerge was built with v2.0.50727 of the .NET Runtime. If you have an earlier version (e.g., Beta2 is v2.0.50215), then you need to use a config file: ILMerge.exe.config. (Copy the text from the browser and put into a file with that name. But check to see if you get any extraneous characters that the browser throws in. If so, please let me know and I’ll see what I can do.)

Currently, ILMerge works only on Windows-based platforms. It does not yet support Rotor or Mono.

If you use ASP.NET v2.0, then it provides a tool (based on ILMerge) to combine assemblies created during precompilation. You can get more details from the ASP.NET web site.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值