mono mkbundle utility on windows

2019-04-10 19:35发布

问题:

There has been a fair amount of mention of the Mono utility mkbundle which is supposed to (among other things) allow you to create a bundle (standalone .exe) with a C# project compiled with Mono. This works when I run it in Cygwin, however what I really would like to do is use the --deps option and --static option to pull in all of the dependencies and libraries so that it really is a standalone. While running the command in Cygwin, it claims that --static is unsupported under the current platform (I assume it is referring to windows). The question, then is :

Is there any way around this dilemma?

If not, what specific .dlls am I now required to carry along with my executable in order to get the thing running? It doesn't seem to be listed anywhere on the mono site.

Thanks!

回答1:

http://linux.die.net/man/1/mkbundle:

On Windows systems, it it necessary to have Unix-like toolchain to be installed for mkbundle to work. You can use cygwin's and install gcc, gcc-mingw and as packages. (sic)



回答2:

There are no way to make a crossplatform app in mono with all necessary libraries included because these libraries will rely on some specific non-managed libraries.
The right way here is to create an installer (using wix for example) for your application and include a mono installer in it. So when you'll install your app the mono will be installed too. For linux you'll need to create an installer too.