我一直在尝试使用 mkbundle 编译或捆绑我的应用程序。这是我正在执行的脚本:
set -o errexit
set -o nounset
mono_version="3.2.3"
export MONO=/cygdrive/c/progra~2/Mono-$mono_version
machineconfig=$PROGRAMFILES\\Mono-$mono_version\\etc\\mono\\4.0\\machine.config
export PATH=$PATH:$MONO/bin
export PKG_CONFIG_PATH=$MONO/lib/pkgconfig
icon_name='"icon.ico"'
echo "1 ICON $icon_name" > icon.rc
export CC="i686-pc-mingw32-gcc icon.o -U _WIN32"
output_name=Output.exe
mkbundle JiraTempoApp.exe MonoPosixHelper.dll gtk-sharp.dll glib-sharp.dll atk-sharp.dll gdk-sharp.dll glade-sharp.dll glib-sharp.dll pango-sharp.dll RestSharp.dll JiraRestLib.dll --deps --machine-config "$machineconfig" -o $output_name -z
rm icon.rc
rm icon.o
cp $MONO/bin/mono-2.0.dll .
cp $MONO/bin/zlib1.dll .
./$output_name
我不得不添加 MonoPosixHelper.dll,因为我得到了一个 EntryPoint not found 错误。现在我得到了这个奇怪的错误:
$ ./mkbundle_cygwin.sh
OS is: Windows
WARNING:
Check that the machine.config file you are bundling
doesn't contain sensitive information specific to this machine.
Sources: 11 Auto-dependencies: True
Unhandled Exception:
IKVM.Reflection.BadImageFormatException: Exception of type 'IKVM.Reflection.BadImageFormatException' was thrown.
at IKVM.Reflection.Reader.PEReader.RvaToFileOffset (UInt32 rva) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Reader.ModuleReader.Read (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Reader.ModuleReader..ctor (IKVM.Reflection.Reader.AssemblyReader assembly, IKVM.Reflection.Universe universe, System.IO.Stream stream, System.String location) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Universe.OpenRawModule (System.IO.Stream stream, System.String location) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Universe.OpenRawModule (System.String path) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Universe.LoadFile (System.String path) [0x00000] in <filename unknown>:0
at MakeBundle.LoadAssembly (System.String assembly) [0x00000] in <filename unknown>:0
at MakeBundle.LoadAssemblies (System.Collections.Generic.List`1 sources) [0x00000] in <filename unknown>:0
at MakeBundle.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: IKVM.Reflection.BadImageFormatException: Exception of type 'IKVM.Reflection.BadImageFormatException' was thrown.
at IKVM.Reflection.Reader.PEReader.RvaToFileOffset (UInt32 rva) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Reader.ModuleReader.Read (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Reader.ModuleReader..ctor (IKVM.Reflection.Reader.AssemblyReader assembly, IKVM.Reflection.Universe universe, System.IO.Stream stream, System.String location) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Universe.OpenRawModule (System.IO.Stream stream, System.String location) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Universe.OpenRawModule (System.String path) [0x00000] in <filename unknown>:0
at IKVM.Reflection.Universe.LoadFile (System.String path) [0x00000] in <filename unknown>:0
at MakeBundle.LoadAssembly (System.String assembly) [0x00000] in <filename unknown>:0
at MakeBundle.LoadAssemblies (System.Collections.Generic.List`1 sources) [0x00000] in <filename unknown>:0
at MakeBundle.Main (System.String[] args) [0x00000] in <filename unknown>:0
我的 .exe 已在 Windows 和 Ubuntu 上成功运行,但我正在尝试捆绑它,以便用户不必下载单声道。