ILMerge Class

MSBuild

A wrapper for the ILMerge tool.


Namespace: MSBuild.Community.Tasks
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)

Syntax

Visual Basic (Declaration)
Public Class ILMerge
    Inherits ToolTask
C#
public class ILMerge : ToolTask
C++
ref class ILMerge : ToolTask
J#
public class ILMerge extends ToolTask
JScript
public class ILMerge extends ToolTask

Example

This example merges two assemblies A.dll and B.dll into one:

 Copy Code
             <PropertyGroup>
                 <outputFile>$(testDir)\ilmergetest.dll</outputFile>
                 <keyFile>$(testDir)\keypair.snk</keyFile>
                 <excludeFile>$(testDir)\ExcludeTypes.txt</excludeFile>
                 <logFile>$(testDir)\ilmergetest.log</logFile>
             </PropertyGroup>
            
             <ItemGroup>
                 <inputAssemblies Include="$(testDir)\A.dll" />
                 <inputAssemblies Include="$(testDir)\B.dll" />
            
                 <allowDuplicates Include="ClassAB" />
             </ItemGroup>
            
             <Target Name="merge" >
                <ILMerge InputAssemblies="@(inputAssemblies)" 
                    AllowDuplicateTypes="@(allowDuplicates)"
                    ExcludeFile="$(excludeFile)"
                    OutputFile="$(outputFile)" LogFile="$(logFile)"
                    DebugInfo="true" XmlDocumentation="true" 
                    KeyFile="$(keyFile)" DelaySign="true" />
             </Target>

Remarks

The ILMerge tool itself must be installed separately. It is available here.

The command line options "/wildcards" and "/lib" of ILMerge are not supported, because MSBuild is in charge of expanding wildcards for item groups.

Inheritance Hierarchy

System.Object
   Microsoft.Build.Utilities.Task
      Microsoft.Build.Utilities.ToolTask
         MSBuild.Community.Tasks.ILMerge

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also

Syntax based on .NET Framework version 2.0.
Documentation version 1.0.0.0.