Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Excerpt

How to combine Boo.Lang.dll into your own app using ILMerge.

Anytime you create an application or library using Boo, you have to distribute the Boo.Lang.dll with it in order for it to run. This is not always desirable for libraries.

ILMerge

ILMerge can combine multiple .NET assemblies into one dll or exe. It is currently Windows only, but your combined exe or dll should run on other platforms using Mono. Eventually there will be similar tools available for Mono. There is already one called mkbundle, but it combines the entire mono runtime into your app.

After you install ILMerge, the ILMerge.exe command line tool should be located under C:\Program Files\Microsoft\ILMerge\. You may want to add this to your PATH variable so you don't have to type the whole path, or else drag a copy of ILMerge.exe to C:\Windows\System32.

(See the ASP.NET page for tips on how to use the Windows command line and how to add paths to your PATH variable)

Using ILMerge to combine Boo.Lang.dll

The simplest way to combine Boo.Lang.dll into your exe or dll is this command:

Code Block
//an exe:
ilmerge /out:combined.exe path\to\Boo.Lang.dll path\to\my.exe

//a dll:

ilmerge /out:combined.dll path\to\Boo.Lang.dll path\to\my.dll

There are also other advanced options for ILMerge that control features like assembly attributes and key signing. See the ILMerge page for more information.

Gotchas

Note though, by adding multiple modules together into one dll, it does change how you can use that dll from boo (see BOO-413).
If you have a library with a standalone function ("def sayit(m as string):"), then compile it to a dll, you can import that dll from another boo script and simply call "sayit("hi")". But, if you use ILMerge and combine that dll with boo.lang.dll, that will no longer work. You have to find out the module name and refer to it explicitly, like "SomeModule.sayit("hi")". This may also not be very desirable, so be sure to test your app or library after using ILMerge.

Incorporating this into boo

I'd like a -merge option for booc and sharpdevelop that merges Boo.Lang.dll for me, but unfortunately ILMerge is not open source and licensed for that.