[Mono-osx] How can a custom library be included in a package.

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Feb 4 00:03:29 EST 2011

On Thu, Feb 3, 2011 at 6:31 PM, JasonZ <jzwolak at vt.edu> wrote:
> Thank you guys so much for helping me figure this out!!!
> The project I'm working on is structured like this:
> I have the main executable (a C# / .Net program) compiled to let's call it
> "main.exe" from my source code.  My source code also generates a dll that
> main.exe depends on, let's call it "mylib.dll".  mylib.dll is also a C# /
> .Net program and has lots of calls to Gui classes in the .Net framework,
> including Win Forms.
> I created an empty MonoMac project (no source files) and copied main.exe
> into "bin/Release/main.exe".  At this point I can create a bundle or
> installer, but neither works because mylib.dll is missing.
> Then I right click the project and go to "Add File", select mylib.dll, check
> "Override default build action" and select "Content" for the build action
> and add the file.  Now, when I create a bundle it works (includes the
> mylib.dll in the bundle and the program runs).  But when I create an
> installer... it doesn't include the mylib.dll in the bundle inside the
> installer!
> The thing is, I'm using MonoDevelop just so I can use MonoMac to easily
> bundle Mono with my app... but in fact, I'm compiling my app from the
> command line using autoconf, automake, and other Unix tools.  So I have the
> application running from the command line.  I am currently looking into
> creating the bundle myself, by hand, and just including all the Mono runtime
> libraries.
> I'm just looking for the easiest way to create an installer so my users can
> have an easy experience.  And it seems MonoMac is really close to being
> extremely useful here.  I'm not attached to using MonoMac, so please
> recommend whatever you think is the simplest way to get my application into
> a bundle that includes the Mono runtime.
> Thanks again guys!

If I understand correctly, your MonoMac project isn't actually
building the main executable, but instead you're essentially tricking
it into packaging an executable you created separately, then copying
the dll that executable references in as "content"? That's not going
to work well. MonoDevelop needs to know the main executable and the
full list of dlls it references to pass to the "mmp" packager to
generates self-contained app bundles.

There is indeed a small bug in MonoDevelop that causes dll and exe
"content" files to be omitted, but I don't think this is a big deal,
as the bundler will not pull in the dependencies for such files
anyway, since they're not being treated as references.

I would suggest that you create the app bundle layout using a
makefile, and have it invoke the "mmp" commandline tool from the
MonoMac addin, which does the actual embedding of the runtime and
required class libraries into the app bundle.

Michael Hutchinson

More information about the Mono-osx mailing list