Sti*_*rds 7 c# deployment mono mkbundle
我一直在尝试使用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
Run Code Online (Sandbox Code Playgroud)
我不得不添加MonoPosixHelper.dll,因为我找不到EntryPoint错误.现在我得到了这个奇怪的错误:
$ ./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
Run Code Online (Sandbox Code Playgroud)
我的.exe在Windows和Ubuntu上成功运行,但我正在尝试捆绑它,以便用户不必下载单声道.
mkbundle无法将动态链接库处理为MonoPosixHelper.dll. 如果您希望应用程序在没有单声道的情况下运行,则需要将此(和其他库)与您的应用程序一起部署在目标系统上。
如果您想在 Ubuntu 上运行您的应用程序并且不希望用户安装 libgtk2.0-cil,您还必须libatksharpglue-2.so libgdksharpglue-2.so libglibsharpglue-2.so libgtksharpglue-2.so libpangosharpglue-2.so根据*-sharp.dll需要进行部署。
然后确保目标系统能够找到这些库。通过LD_LIBRARY_PATH在构建系统上定义或创建 DLL 映射(这很棘手并且可能会有点乏味)。
您还可以传递--static参数以mkbundle将所有需要的单声道库直接包含在您的包中(有关详细信息,请参阅联机帮助页)。MyApp.exe另外,仅使用not with执行最终的捆绑包mono MyApp.exe。
以下是针对 Linux 目标执行此操作的一些选项。我还没有mkbundle在 Windows 上使用 mono,而只是针对 .NET 使用 进行编译msbuild,这也会创建.msi文件。
$DEPS = "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"
mkbundle --static -o JiraTempoApp JiraTempoApp.exe --deps $DEPS --machine-config "$machineconfig" -z
Run Code Online (Sandbox Code Playgroud)
然后确保部署MonoPosixHelper.dll。以及上面描述的其他.so文件到您的系统。要启动您的应用程序,请执行
LD_LIBRARY_PATH=/path/to/deployed/libs:$LD_LIBRARY_PATH JiraTempoApp
Run Code Online (Sandbox Code Playgroud)
LD_LIBRARY_PATH但是,我目前无法验证此方法是否有效。
使用与选项 1 相同的命令进行构建,但从部署的库的目录中执行:
cd /path/to/deployed/libs; /path/to/JiraTempoApp
Run Code Online (Sandbox Code Playgroud)
这有点复杂:您需要在构建系统上找到依赖项.dll及其文件。.dll.config将它们复制到您的构建目录和配置文件中的 dll 映射,其中映射包含目标.so系统上文件位置的相对路径。这样,dll 映射就会被 mkbundle 打包,并且打包的可执行文件将能够在目标系统上找到已部署的 s。我曾经为使用此选项的应用程序编写过Makefile ,也许它会对您有所帮助。.so
| 归档时间: |
|
| 查看次数: |
1243 次 |
| 最近记录: |