Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


MSBuild task for ILRepack which is an open-source alternative to ILMerge.

Install via NuGet NuGet NuGet

  Install-Package ILRepack.Lib.MSBuild.Task

Supported build tools

  • MSBuild


You just need to install NuGet package to merge all your project dependencies. If you want to customize the process then you can create a file named "ILRepack.targets" in your project folder. You can create it like shown below.

Example "ILRepack.targets"

<!-- ILRepack -->
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="">
    <Target Name="ILRepacker" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">

        <InputAssemblies Include="$(OutputPath)\ExampleAssemblyToMerge1.dll" />
        <InputAssemblies Include="$(OutputPath)\ExampleAssemblyToMerge2.dll" />
        <InputAssemblies Include="$(OutputPath)\ExampleAssemblyToMerge3.dll" />

        <!-- Must be a fully qualified name -->
        <DoNotInternalizeAssemblies Include="ExampleAssemblyToMerge3" />


<!-- /ILRepack -->


You need to create "ILRepack.Config.props" file in your project folder to configure the behavior of ILRepack.Lib.MSBuild.Task.

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="">

You can specify following options inside the <PropertyGroup> element to configure the behavior of the ILRepack task.

Specify your custom Targets file path

If you don't want to add "ILRepack.targets" file in your project folder then you can specify your targets file path as shown below.


Specify Key File to use for signing

You can specify the path of the SNK file you want to use for signing your assembly as shown below. This configuration option only applies if you are using default targets file provided in NuGet package.


Specify whether to clear directory after merging

If you are using default targets file then you may notice that it clears Output directory after merging dependencies. You can turn this functionality off by setting ClearOutputDirectory to False as shown below.


Task options

Option Description
KeyFile Specifies a KeyFile to sign the output assembly.
KeyContainer Specifies a KeyContainer to use.
LogFile Specifies a logfile to output log information.
Union Merges types with identical names into one.
DebugInfo Enable/disable symbol file generation.
AttributeFile Take assembly attributes from the given assembly file.
CopyAttributes Copy assembly attributes.
AllowMultiple Allows multiple attributes (if type allows).
TargetKind Target assembly kind (Exe|Dll|WinExe|SameAsPrimaryAssembly).
TargetPlatformVersion Target platform (v1, v1.1, v2, v4 supported).
TargetPlatformDirectory Path of Directory where target platform is located.
XmlDocumentation Merge assembly xml documentation.
LibraryPath List of paths to use as "include directories" when attempting to merge assemblies.
Internalize Set all types but the ones from the first assembly 'internal'.
RenameInternalized Rename all internalized types (to be used when Internalize is enabled).
InternalizeExclude If Internalize is set to true, any which match these regular expressions will not be internalized. If internalize is false, then this property is ignored.
OutputFile Output name for merged assembly.
InputAssemblies List of assemblies that will be merged.
DelaySign Set the keyfile, but don't sign the assembly.
AllowDuplicateResources Allows to duplicate resources in output assembly.
AllowedDuplicateNamespaces Allows the specified namespaces for being duplicated in to input assemblies. Multiple namespaces are delimited by ",".
ZeroPeKind Allows assemblies with Zero PeKind (but obviously only IL will get merged).
Parallel Use as many CPUs as possible to merge the assemblies.
Verbose Additional debug information during merge that will be outputted to LogFile.
NoRepackRes Does not add the embedded resource 'ILRepack.List' with all merged assembly names.
Wildcards Allows (and resolves) file wildcards (e.g. `*`.dll) in input assemblies.
RepackDropAttribute Name of an attribute (optional). Members in input assemblies marked with this attribute will be dropped during merging.


MSBuild task for ILRepack which is an open-source alternative to ILMerge.








No packages published