I'm having a nightmare. I can't seem to get mkbundle to work on Windows using the current version of Mono (5.0.1.1). It's installed in:
C:\Program Files (x86)\Mono
I've got a very simple console application which uses a .net library, made using Xamarin Studio Community 6.1.2 (build 44). It's very simple, the application calls a function in the library and receives a string in return. It then prints this string out to the console.
The application has been compiled targeting "Mono 5.0.1 (Visual) (C:\Program Files (x86)\Mono)" in Xamarin. I had to disable the use of MSBuild engine to get this working. I can confirm the application works as expected running using mono from the command line.
Now I want to package it up so it's all bundled in one simple executable along with the mono runtime environment, so neither mono or .net is required. It all has to be self-contained. I'd also like to include other resource files that the application will use that aren't DLLs.
So after some searching I found mkbundle which seems to tick all the boxes...
First I followed this: How to make "mkbundle --deps" option working with mono 3.2.3
Then I tried this: https://gist.github.com/tebjan/5581296
Then I tried to follow this as best I could: Can not compile simple C# application with mkbundle
Nothing seems to work D:
I understand that these guides/scripts are likely out of date, but I can't even see a way of updating (massive noob with mono at the moment). As an example, here are two errors I've received when attempting to run mkbundle from cmd:
C:\Users\asdf\Documents\Projects\Test\Test\bin\Debug>mkbundle Test.exe --simple -o super.exe
ERROR: The SDK location does not contain a C:\Program Files (x86)\Mono/bin/mono runtime
Unhandled Exception:
System.Exception: Exception of type 'System.Exception' was thrown.
at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.VerifySdk (System.String path) [0x00052] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.Main (System.String[] args) [0x00bd4] in <140d0f6d64494c449b7d56649165e7e4>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Exception of type 'System.Exception' was thrown.
at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.VerifySdk (System.String path) [0x00052] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.Main (System.String[] args) [0x00bd4] in <140d0f6d64494c449b7d56649165e7e4>:0
C:\Users\asdf\Documents\Projects\Test\Test\bin\Debug>mkbundle --sdk "C:\Program Files (x86)\Mono\bin" Test.exe --deps -o super.exe
ERROR: The SDK location does not contain a C:\Program Files (x86)\Mono\bin/bin/mono runtime
Unhandled Exception:
System.Exception: Exception of type 'System.Exception' was thrown.
at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.VerifySdk (System.String path) [0x00052] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.Main (System.String[] args) [0x00b88] in <140d0f6d64494c449b7d56649165e7e4>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Exception of type 'System.Exception' was thrown.
at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.VerifySdk (System.String path) [0x00052] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.Main (System.String[] args) [0x00b88] in <140d0f6d64494c449b7d56649165e7e4>:0
And this an example of me running from mono (although I'm pretty sure I there shouldn't be any difference).
asdf@DIGGLER /cygdrive/c/Users/asdf/Documents/Projects/ConsoleAppAOTDllTest/Co nsoleAppAOTDllTest/bin/Debug
$ mkbundle --simple testlib.exe -o super.exe
ERROR: The SDK location does not contain a C:\Program Files (x86)\Mono/bin/mono runtime
Unhandled Exception:
System.Exception: Exception of type 'System.Exception' was thrown.
at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.VerifySdk (System.String path) [0x00052] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.Main (System.String[] args) [0x00bd4] in <140d0f6d64494c449b7d56649165e7e4>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Exception of type 'System.Exception' was thrown.
at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.VerifySdk (System.String path) [0x00052] in <140d0f6d64494c449b7d56649165e7e4>:0
at MakeBundle.Main (System.String[] args) [0x00bd4] in <140d0f6d64494c449b7d56649165e7e4>:0
Would someone please be awesome, and give me a more up-to-date guide/walkthrough in how to setup the environment?
Thanks in advance, if I'm missing something obvious please feel free to abuse. Apologies for any ignorance in advance. I've been at this for about 12 hours now and I'm losing my mind!
To clear up any queries regarding my use of Mono on a Windows platform. I'm doing it for two reasons. I'd like to be able to bundle the runtime with the application, as it has to be an application that runs without install (double-click to run and off it goes to finish). I don't think this is possible in current .net (I know .net core is playing with some magic to do with compiling to native but it seems very early days) and I tried C++ but got nauseous.