Monday, October 08, 2007

Automate ILMerge'ing - Using Project Attributes to mark an Assembly for merging and then MSBuild to ILMerge them...

Scott Hanselman's ComputerZen.com - Mixing Languages in a Single Assembly in Visual Studio seamlessly with ILMerge and MSBuild

"...

What I really want is to be able to mark an assembly as merge-able and have it automatically merged in just because it's referenced.

Here's what I came up with. Thanks to Dan Moseley and Joshua Flanagan for their help. Thanks to Jomo Fisher for the Target File.

...

Looks like they are both in there. To refresh, if I want to merge in VB assemblies:

  • Change the referencing CSPROJ to import "IlMerge.CSharp.targets"
  • Add <IlMerge>True</IlMerge> to the references you want merged in.
  • Save, Reload, Build

C# and VB, living together, mass hysteria!"

This is pretty cool.

I really dig the thought of just adding an project attribute to my assembly projects and having them automatically ILMerged during the build (much more so than ILMerging in post-build events).

 

Related Past Post XRef:
AsmZip - Compressing and Hiding Assemblies/DLL's in your .Net EXE
Gilma - GUI for ILMerge Branched for .Net 2.0
VS2005 Power Toys Pack Installer
MSBuild and ILMerge
"Gilma - GUI for ILMerge Application"
ILMerge Updated
The Code Project - Merging .NET assemblies using ILMerge - .NET

No comments: