How can I link a Mono / GTK # application on Linux?

Here is the problem I'm running into: I wrote a Gtk # program using MonoDevelop and it works great. But now I want to be able to run it on other Linux boxes without installing MonoDevelop.

My solution has two projects, the main Gtk # application and the C # library project it depends on. So when I create the main project, it makes MainProject.exe and MainProject.exe.mdb along with DependencyProject.dll in bin / Release folder.

I tried running the following command to package it all into one executable file (run from bin / Release folder):

mkbundle MainProject.exe -o mainproject --deps *.dll

      

However, I am getting this error from running this command:

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.

Filename: gtk-sharp

at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000] at: 0

at (wrapper remoting-invoke-with-check) System.AppDomain: Load (string, System.Security.Policy.Evidence, bool)

at System.Reflection.Assembly.ReflectionOnlyLoad (System.String assemblyString) [0x00000] at: 0

at IKVM.Reflection.Universe.DefaultResolver (System.String refname, Boolean throwOnError) [0x00000] at: 0

at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, Boolean throwOnError) [0x00000] at: 0

at IKVM.Reflection.Universe.Load (System.String refname) [0x00000] at: 0

in files MakeBundle.QueueAssembly (System.Collections.Generic.List`1, System.String codebase) [0x00000] to: 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.

Filename: gtk-sharp

at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000] at: 0

at (wrapper remoting-invoke-with-check) System.AppDomain: Load (string, System.Security.Policy.Evidence, bool)

at System.Reflection.Assembly.ReflectionOnlyLoad (System.String assemblyString) [0x00000] at: 0

at IKVM.Reflection.Universe.DefaultResolver (System.String refname, Boolean throwOnError) [0x00000] at: 0

at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, Boolean throwOnError) [0x00000] at: 0

at IKVM.Reflection.Universe.Load (System.String refname) [0x00000] at: 0

in files MakeBundle.QueueAssembly (System.Collections.Generic.List`1, System.String codebase) [0x00000] to: 0

I have seen several other stack overflow problems with similar problems, but none have offered any practical solutions. How to use this command effectively mkbundle

?

+3


source to share


1 answer


mkbundle

great if you want a completely standalone application that doesn't rely on mono or anything related to mono that needs to be installed on the target machine.

However, on mono-countries you might read: "The resulting executable is self-contained and does not require a set Mono runtime. However, if your application uses libraries related to the mono runtime or Gtk #, they must be installed (the Gtk # helper libraries come at mind) ".

If you just want to create one executable from several dlls , then ILRepack is the best choice.



If you are deploying on Windows you can simply include the GTK # installer with your application (.NET is most likely already present). If you are deploying Linux or Mac, the mono packages must be installed (optional mono-complete

) before running the application .

Hope it helps.

0


source







All Articles