【发布时间】:2018-03-22 07:02:17
【问题描述】:
我做噩梦了。我似乎无法让 mkbundle 使用当前版本的 Mono (5.0.1.1) 在 Windows 上工作。它安装在:
C:\Program Files (x86)\Mono
我有一个非常简单的控制台应用程序,它使用 .net 库,使用 Xamarin Studio Community 6.1.2(内部版本 44) 制作。很简单,应用程序调用库中的一个函数并接收一个字符串作为返回。然后它将这个字符串打印到控制台。
该应用程序已针对 Xamarin 中的“Mono 5.0.1 (Visual) (C:\Program Files (x86)\Mono)”进行编译。我必须禁用 MSBuild 引擎才能使其正常工作。我可以从命令行使用 mono 确认应用程序按预期运行。
现在我想将它打包,以便与单声道运行时环境一起捆绑在一个简单的可执行文件中,因此不需要单声道或 .net。这一切都必须自给自足。我还想包含应用程序将使用的不是 DLL 的其他资源文件。
所以经过一番搜索,我发现 mkbundle 似乎勾选了所有框...
首先我遵循了这个: How to make "mkbundle --deps" option working with mono 3.2.3
然后我尝试了这个: https://gist.github.com/tebjan/5581296
然后我尽我所能地遵循这个: Can not compile simple C# application with mkbundle
似乎没有任何效果 D:
我知道这些指南/脚本可能已经过时了,但我什至看不到更新的方法(目前是单声道的大量新手)。例如,以下是我在尝试从 cmd 运行 mkbundle 时收到的两个错误:
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
这是我从单声道运行的一个例子(尽管我很确定我不应该有任何区别)。
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
有没有人可以给我一个关于如何设置环境的最新指南/演练?
提前致谢,如果我遗漏了一些明显的东西,请随意滥用。 提前为任何无知道歉。我已经在这玩了大约 12 个小时了,我快疯了!
清除有关我在 Windows 平台上使用 Mono 的任何疑问。我这样做有两个原因。我希望能够将运行时与应用程序捆绑在一起,因为它必须是无需安装即可运行的应用程序(双击运行并关闭它即可完成)。我认为这在当前的 .net 中是不可能的(我知道 .net 核心正在玩一些与编译到本机有关的魔法,但似乎还很早),我尝试了 C++,但感到恶心。
【问题讨论】:
-
在这里查看我的帖子答案:stackoverflow.com/questions/39905982/… 这可能会对您有所帮助
标签: c# .net mono monodevelop