A lightweight .NET assembly dependency merger that uses dnLib and 7zip's LZMA SDK for compressing dependant assemblies.


Keywords
Install
Install-Package dnMerge -Version 0.5.15

Documentation

dnMerge

Intro

dnMerge is an MSBuild plugin that will merge multiple .NET reference assemblies into a single .NET executable or DLL. dnMerge can be included within your .NET project using the NuGet package available from the central repo.

Merged assembiles are compressed with 7-Zip's LZMA SDK which has the added benefit of smaller executables in comparison with other .NET assembly mergers. No additional .NET references are including during merging, making dnMerge suitable for cross-compiling on Linux without pulling in .NET Core assembly references into the final merged assembly.

Usage

Simply add the dnMerge NuGet dependency into your .NET project and compile a release build. Currently only release builds are merged since debug symbols are lost during merging.

Customisation

dnMerge supports customising how the merged assembly merged. Currently you can exclude assemblies from being merged, turn PDB generation on and off and control if the the merged assemlby is overwritten or if it's saved to a new file. Just create a file called dnMerge.config inside the project folder that is using dnMerge. Example configuration below.

<dnMergeConfig>
    <GeneratePDB>false</GeneratePDB>
    <OverwriteAssembly>true</OverwriteAssembly>
    <ExcludeReferences>
        <ReferenceName>bofnet.dll</ReferenceName>
    </ExcludeReferences>
</dnMergeConfig>

Credits

  • dnMerge uses the brilliant dnLib library for .NET assembly modifications. Without this library dnMerge would not be possible.
  • 7-Zip LZMA SDK.