*
Quick Links|Home|Worldwide
Microsoft*
Search for



  ILMerge

06/26/08

Home
Biography
Research
ILMerge

 

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.

Commercial use permitted:
The language of ILMerge's license has raised many questions. In a nutshell: commercial use is permitted, redistribution is not. Read the license carefully for full details since I am not (nor do I wish to be!) a lawyer.

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.8.0626 (created on 26 June 2008). 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 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. (Use "Save As..." to save the file. If you copy it from the browser, I believe you will get some extraneous characters that the browser throws in.)

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.

GUI Wrappers

There are several GUIs available that wrap ILMerge:

  • Tomer Shalev and Lior Brill have written Gilma.
  • DILMerge has been written by Mauro Venturini that specifically targets and integrates with Borland Delphi for .NET.
  • Anthony Nystrom has one named NuGenUnify.

Redistribution

From time to time I have gotten requests from ILMerge users who would like to redistribute ILMerge as part of their own application because their users need it on the client machines in order to run the application. Unfortunately, the license for ILMerge does not permit redistribution. However, I have just found out about an alternative solution that may work for you. The Visual Studio Power Toys team has just put out a new product, the Power Toys Pack Installer. It brings up a single window in which one can select multiple tools. It then aggregates the license agreements so that one click by the user accepts all of the licenses (of the selected tools). It then runs the installer for each tool in turn. So it isn’t redistributing the tools, but consolidating their license agreement screens and installers so that users do not have to manually go to the web site for each tool and install it themselves. The source code the Pack Installer is under a very liberal license, the Microsoft Permissive License (Ms-PL). This means that you can use their source code for your own application’s installer to achieve the same effect. I do not know anything about the code, so if you have questions about it, please contact them directly.

Change History

Version Date Notes
2.8.0626 26 June 2008 Fix a small bug for attributes (i.e., their constructors) that take arrays of values.
2.8.0502 2 May 2008 Restored the code that controls whether the /v1.1 option is recognized. A build process break caused it to be left out.
2.8.0422 22 April 2008 Added an option, /align, that allows the file alignment of the target assembly to be set.
2.8.0202 2 February 2008 Fixed a regression that prevented v1.1 assemblies from being merged.
2.0.7.1228 28 December 2007 Fix for method security attributes.
2.0.7.1226 26 December 2007 Allow Merge() to be called more than once. (This changes ILMerge's behavior only if you are using it programmatically, i.e., not from the command-line.)
2.0.7.1129 29 November 2007 Many bug fixes. New /union command-line option for merging duplicate types into a single type in the target assembly.
2.0.7.228
1.1.7.228
28 February 2007 Fixes problem where merged assemblies ran as a 32-bit process even on a 64-bit machine.
ILMerge is now a strongly-named assembly.
Fixes a problem with adjusting the accessibility of a type when a subtype has a more restricted accessibility.
Makes sure there are no duplicate assembly names in the list of input assemblies.
Various generics fixes.
On an error, the stack trace is now written to the log.
2.0.7.213
1.1.7.213
13 February 2007 Fixes problem with running merged assemblies in the Compact Framework.
2.0.7.209
1.1.7.209
9 February 2007 Fixes for running merged assemblies on 64 bit machines.
Treat security attributes the same way as "regular" assembly-level attributes (i.e., the /attr and /copyattrs options).
The visibility of the hidden class now matches that of the hidden class in the "attribute assembly" (i.e., the one specified by /attr or the primary assembly if /attr is not specified).
Other bug fixes.
2.0.7.112
1.1.7.112
12 January 2007 Bug fixes for compact framework.
2.0.7.102
1.1.7.102
2 January 2007 Changed the default so external references are listed in the manifest with their public key token and not their full public key. Use the new option /useFullPublicKeyForReferences to get the old behavior. Many fixes for generics. Other bug fixes.
2.0.0.60815
1.1.0.60815
15 August 2006 Fixed a problem with generics. May have fixed the problem with resources that were not merged properly. Now if a type gets renamed, then any associated resources are also renamed appropriately. Bug fixes.
2.0.0.60228
1.1.0.60228
28 February
2006
Public keys that are longer than 1024 bits now work. Bug fixes.
2.0.0.60207
1.1.0.60207
7 February 2006 Made the v1.1 version available again. But it does not have the cross-platform capabilities of the v2.0 version.
Many bug fixes.
2.0.0.51214 14 December 2005 When the target platform is not v2, then if debug info had been on, it is turned off.
Added an option /allowMultiple that can be used in combination with the /copyattrs option to allow multiple instances of assembly-level attributes. But only if the attribute is defined to allow multiples, otherwise each instance overwrites any previously copied over instances.
2.0.0.51209 09 December 2005 Error checking to make sure the version number gets set correctly when specified on the command line. Don't set the version number when there is an error in the version number.  Release all assemblies used during the merge, not just the ones specified as input assemblies. Added a check to make sure the target assembly does not list itself as an external reference. This catches situations where ILMerge fails because of a bad user command. Xmldocs files now have the extension ".xml" instead of ".doc". Many bug fixes, especially related to generics.
2.0.0.51008 08 October 2005 Some generics fixes, check up front for any null strings passed in as input assembly names.
2.0.0.50920 20 September 2005 ILMerge is now a .NET Framework version 2.0 application. That means in order to run it, the v2 CLR must be installed. To merge assemblies for previous versions of .NET, use the /v1.1 option (e.g. for version 1.1).
The /xmldocs option has been added to merge any XML documentation files that are present for the input assemblies.
Version numbers are now "2.0.0.<last digit of year><month><day>".
1.0.2081.20884 12 September 2005 More generics fixes. Allow "/v2" to be used in place of the targetplatform option as long as the v2 framework is in the standard location. (Also "/v1" or "/v1.1" can be used in the same way.) Unresolved reference exceptions now print out the name of the offending assembly.
1.0.2060.16593 22 August 2005 More generics fixes.
1.0.2053.16481 15 August 2005 Many bug fixes related to generics and other topics.
The /allowDup option has been added to allow duplicate public types to be renamed. This allows obfuscated assemblies to be merged since obfuscators (at least one of them) defines the same attribute in each assembly it creates.
1.0.1952.21848 9 May 2005 The /delaysign option has been added so the target assembly can be delay signed. Note that the /snk option has been renamed to be /keyfile.
Retargetable external assembly references are now handled correctly.
Fixed the reading of serialized array types in custom attributes.
Updated the documentation.
1.0.1923.13862 7 April 2005 All errors encountered in the Main method are now written to the Console instead of the log. It had been the case that if /log was not specified, ILMerge was silent in the face of errors.
Abort processing if any of the input assemblies has a metadata import error.
Now exclusions to internalize can use the assembly name: "\[A\].*" excludes all types in assembly A from being made non-public. The backslashes are required because the string is treated as a regular expression. The regular expression is still checked against just the type name first, so the assembly does not need to be specified: "N.T" will exclude all types with that name no matter what assembly they are found in.
The requirement on the PeKind of each input assembly is now weaker: all must agree by either not being machine/processor-specific or have the same machine/processor-specific marking.
1.0.1899.17933 16 March 2005 Same as previous version, but first released on MSDN which permits commercial usage.
1.0.1896.20590 11 March 2005 Fixed a problem that cause the /wildcards option to make the searching in the search directories not work. Correctly adjust the accessibility of methods even if they are in a nested type. Correctly implement the /copyattrs option. ILMerge is now instance-based. This should affect only its programmatic use and should be invisible when used from the command line. It might help with releasing resources acquired during merging.
1.0.1816.20370 21 December 2004 For backward compatibility, wild cards in input assembly names are allowed only when the /wildcards option is specified. Fixed some general errors.
1.0.1810.17247 15 December 2004 Allow wild cards in input assembly names.
1.0.1762.21538 28 October 2004 Last release somehow had bad bits in it which meant that exceptions were propagated to the caller.
1.0.1760.24350 26 October 2004 Another fix for marshalling of return values. Widen method accessibility if it is "protected" and overriding a "protected internal" method from another input assembly.
1.0.1733.14048 29 September 2004 General bug fixes (includes marshalling info preservation).
1.0.1713.28770 09 September 2004 Added /zeroPeKind option, fix for marshalling of return values.
1.0.1704.20936 31 August 2004 Added /publickeytokens option, fixes for C++ assemblies.
1.0.1698.27076 25 August 2004 General bug fixes.
1.0.1683.11907 10 August 2004 General bug fixes.
1.0.1663.20263 22 July 2004 Previous version produced unverifiable assemblies. (Sigh.)
1.0.1661.24486 19 July 2004 Fix for incorrect behavior for /ndebug option and /t:exe option. General bug fixes.
1.0.1545.17990 25 March 2004 Fixed the /t:winexe option.
1.0.1532.17922 12 March 2004 General bug fixes.
1.0.1528.38113 9 March 2004 Added /targetplatform option. General bug fixes.
1.0.1508.17205 17 February 2004 General bug fixes.
1.0.1500.21612 10 February 2004 Assembly-level attributes: /copyattrs, /attr options added.

Home | Biography | Research | ILMerge

This site was last updated 06/26/08


©2008 Microsoft Corporation. All rights reserved. Terms of Use |Trademarks |Privacy Statement