Possible to include Mono Runtimes in OSX .app bund

2019-01-31 10:23发布

问题:

I'm looking to work on an application that needs to run on both Windows and OSX. Since I'm already very familiar with C#/.NET I thought I would take a look at using Mono. But I also want it to very easy to install and don't want the users to have to install the Mono package separately. Is it possible to create an OS X .app bundle that simply includes EVERYTHING? That is, my app, resources and the complete Mono runtime?

回答1:

Yes, you can do this. Pick an app, any app, and Show Package Contents. Explore around a bit and you'll see that there's a Contents/MacOS directory inside. It will contain a file with the execute bit set. This can be machine code or any old script with a #! line at the beginning. All you need to do is duplicate the directory structure with a skeleton app, shove your Mono runtime into the Resources directory somewhere, and write a bash script that initializes everything. There may be automated utilities for doing this floating around somewhere, but it's pretty easy to do this manually.

I'd recommend using your favorite build tool to automate this process.



回答2:

It is possible, with quite a bit of hacking and some toolchain fun to compile a .NET app statically targeted for the Mac OS platform, no need to deploy mono with it. Check out this website talking about how Mono is being used statically in some iPhone apps.

http://arstechnica.com/open-source/news/2009/01/open-source-mono-framework-brings-c-to-iphone-and-wii.ars

Another great resource is the #mono channel on irc.gnome.org or irc.gimp.net (http://mono-project.com/IRC)



标签: c# macos mono