Using ILMerge on .Net 2.0 Beta 2

time to read 2 min | 238 words

I've some assemblies that I want to merge to one big assembly. I used to do it for .Net 1.1 with ILMerge, but now it fails since I'm compiling for the 2.0 framework.

The first thing that I tried was to download the latest bits (from three days ago, actually). That still didn't work, so I tried to use runtime binding, which would cause ILMerge to run on the .Net 2.0 platform. That worked!

Here is the binding that I used:

<?xml version="1.0"?>
<configuration>
    <startup>
        <supportedRuntime version="v2.0.50215" />       
    </startup>
</configuration>

Just to note, any assemblies produced by ILMerge after this change will be a 2.0 assemblies, even if the originating assemblies were 1.0 or 1.1. I'm sure that there are other, arguably better, ways to solve this, but I simply saved the above file as ILMerge2.exe.config and copied the ILMerge.exe to ILMerge2.exe; now I can just call ilmerge2 when I want to merge files to a 2.0 assemby, and ilmerge when I want to merge to a 1.1 assembly.