1/21/2005

ILMerge, Assemblies, and how to set a VS.NET Reference to a .NET EXE file

I've always liked Michael Barnett's writing, and the happiness increased when I found out that he was working for Microsoft Research and had authored the marvelous ILMerge Utility.

For example, I can combine three different assemblies into the same executable for my IE Favorites Synchronizer utility like so:

c:\ILMERGE\ilmerge /target:winexe /out:FavSynchro.exe FavSynch.exe ftp.dll ICSharpCode.SharpZipLib.dll

I get FavSynchro.exe, which is 100% self - contained (except for the Runtime). Sweet!


Problem is, ILMerge.exe is a console app and It only has a command line interface. Of course, the C# command line compiler, CSC.EXE, does support setting references to .NET Executable assemblies, but that too is a command - line program - yuk!
I wanted to build a nice Windows Forms-based utiltiy wrapper with File dialogs and all the stuff you would expect.
So, what did I do? I changed the extension on a copy of ILMerge.exe to ".dll" and Presto! Set a reference to it in the VS.NET IDE with no problem. Think outside the box.