2

I have a .NET 4.0 solution with about 10 projects that I am successfully compiling on mono 2.10.8.1 on Ubuntu Desktop 12.04, which is running in a VM.

I am trying to run mkbundle to combine all 10 DLLs into a single DLL that I can then reference in other solutions (i.e. some core libraries that will be heavily reused in higher level applications).

This is what I am running to build the solution:

xbuild /nologo CoreApp.sln

Then I am running the following to combine the DLLs:

mkbundle -c --nomain -o Build/CoreApp.dll Build/FirstLibrary.dll Build/SecondLibrary.dll Build/ThirdLibrary.dll

This successfully completes, and I get CoreApp.dll.

However, when I try to build the dependent solution, I get the following exception:

Error CS0009: Metadata file `/home/user/project/Build/CoreApp.dll' does not contain valid metadata (CS0009) (HigherLevelApp.Impl)

I'd be happy to provide more information if necessary.

karlgrz
  • 14,485
  • 12
  • 47
  • 58

2 Answers2

2

mkbundle is for creating a standalone binary, not merging several libraries into one.

You want something like il-merge.

Rolf Bjarne Kvinge
  • 19,253
  • 2
  • 42
  • 86
2

mkbundle is not an IL merger. The output of the tool is a self contained application (with or without mono itself). As such it's not usable anymore by other .NET projects.

What mkbundle allows you is to distribute a single file that contains everything you need to execute a single .NET application.

What you're looking for is a way to merge several assemblies into a new assembly. Microsoft has such a tool and a few other products (many based on Mono.Cecil) do similar things.

poupou
  • 43,413
  • 6
  • 77
  • 174
  • @KG. the tool itself does not but the output (.dll) *should* be usable on both MS .NET and Mono since it should follow the same ECMA rules are the original assemblies. – poupou Jun 20 '12 at 13:13