mkbundle 和 GTK#

mkbundle and GTK#(mkbundle 和 GTK#)
本文介绍了mkbundle 和 GTK#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 mkbundle,这样我就可以分发 GTK# 应用程序,而无需用户安装 .NET/Mono 或 GTK#.我已经成功地捆绑了一个使用 winforms 的应用程序,但由于某种原因,当我对 GTK# 应用程序执行相同操作时,它就不起作用了.

I'm trying to use mkbundle so that I can distribute a GTK# application without users needing to install .NET/Mono or GTK#. I've successfully bundled an application which uses winforms, but for some reason when I do the same with a GTK# application it won't work.

这就是我从 cygwin 中得到的:

This is what I get out of cygwin:

$ mkbundle --deps a.exe操作系统是:Windows来源:1 自动依赖:True

未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集gtk-sharp"或其依赖项之一.系统找不到指定的文件.
文件名:'gtk-sharp'
在 System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00000] in :0
在 (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
在 System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] 中:0
在 (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
在 System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] 中:0
在 MakeBundle.QueueAssembly(System.Collections.ArrayList 文件,System.String 代码库)[0x00000] 中:0
在 MakeBundle.Main (System.String[] args) [0x00000] in :0
[错误] 致命的未处理异常:System.IO.FileNotFoundException:无法加载文件或程序集gtk-sharp"或其依赖项之一.系统找不到指定的文件.
文件名:'gtk-sharp'
在 System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00000] in :0
在 (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
在 System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] 中:0
在 (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
在 System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] 中:0
在 MakeBundle.QueueAssembly(System.Collections.ArrayList 文件,System.String 代码库)[0x00000] 中:0
在 MakeBundle.Main (System.String[] args) [0x00000] in :0`

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'gtk-sharp' or one of its dependencies. The system cannot find the file specified.
File name: 'gtk-sharp'
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in :0
at MakeBundle.QueueAssembly (System.Collections.ArrayList files, System.String codebase) [0x00000] in :0
at MakeBundle.Main (System.String[] args) [0x00000] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'gtk-sharp' or one of its dependencies. The system cannot find the file specified.
File name: 'gtk-sharp'
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in :0
at MakeBundle.QueueAssembly (System.Collections.ArrayList files, System.String codebase) [0x00000] in :0
at MakeBundle.Main (System.String[] args) [0x00000] in :0`

但我的 PATH 变量中有/cygdrive/c/GtkSharp/2.12/lib.我可以检查一下,就好像我在 cygwin 中输入gtk-sharp.dll"一样,我得到以下返回:

But yet I have /cygdrive/c/GtkSharp/2.12/lib in my PATH variable. I can check this, as if I type "gtk-sharp.dll" into cygwin I get the following returned:

$ gtk-sharp.dllbash:/cygdrive/c/GtkSharp/2.12/lib/gtk-sharp-2.0/gtk-sharp.dll: 无法执行二进制文件

所以它应该能够找到文件!

So it should be able to find the file!

任何帮助将不胜感激.

推荐答案

我找到了一个shell脚本,它可以完成所有这些并将其修改为最新版本,截至2013年5月,您可以使用该脚本如下:

I found a shell script which does all this and modified it to the latest versions, as of May 2013 you can just use the script as follows:

https://gist.github.com/tebjan/5581296

1.) 安装 cygwin 并确保选择以下软件包:- gcc-mingw- 包配置- mingw-zlib1- mingw-zlib-devel

1.) Install cygwin and make sure you select the following packages: - gcc-mingw - pkg-config - mingw-zlib1 - mingw-zlib-devel

2.) 安装 Mono 发行包:Mono for Windows, Gtk#, and XSP"

2.) Install the Mono release package: "Mono for Windows, Gtk#, and XSP"

3.) 下载脚本,将其放在您的应用程序旁边并对其进行修改以适应您的环境(仔细阅读文件中的注释).

3.) Download the script place it besides your Application and modify it to fit your environment (read the comments in the file carefully).

4.) 打开 cygwin 并导航到 ececutable 和 scipt 所在的应用程序的输出文件夹,例如YourProject/bin/Release

4.) Open cygwin and navigate to the output folder of your application where the ececutable and the scipt lies, e.g. YourProject/bin/Release

5.) 使用以下命令执行脚本:./mkbundle_cygwin.sh

5.) Execute the script with the command: ./mkbundle_cygwin.sh

疑难解答:如果捆绑的可执行文件不起作用,请确保原始 .NET 应用程序在单声道上运行.您可以通过调用 mono.exe 并将您的 .NET 应用程序传递给它或通过安装 XamarinStudio 并从那里运行您的项目来测试它(让您将 mono 设置为运行时).

Troubleshooting: If your bundled executable does not work make sure the original .NET application works on mono. You can test that by calling mono.exe and pass your .NET app to it or by installing XamarinStudio and running your project from there (make you set mono as runtime).

这篇关于mkbundle 和 GTK#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)