I have this really simple Hello World example i wrote on a linux host using Mono and gtk#. It simply shows a windows with a button. Now i tried to get the binary running on windows but failed. i installed the gtk# with the standalone installer from the mono homepage. when i start the application it failes due to:
System.DllNotFoundException was unhandled: Unable to load DLL 'libglib-2.0-0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) Source=glib-sharp
Any suggestions? BR
You need either to run your app via mono.exe or just add the mono.exe location to the PATH environment variable value. You can do that in run-time like that:
[STAThread]
public static void Main(string[] args)
{
var dllDirectory = @"C:\Program Files (x86)\Mono\bin";
Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + dllDirectory);
Run();
}
private static void Run()
{
Gtk.Application.Init();
Forms.Init();
var app = new App();
var window = new FormsWindow();
window.LoadApplication(app);
window.SetApplicationTitle("Game of Life");
window.Show();
Gtk.Application.Run();
}
You will have to register the DLL 'libglib-2.0-0.dll' in Windows using regsvr32 libglib-2.0-0.dll
from the command prompt. An alternative is to just package all the dependencies with your executable.
Hope this was helpful.
-Dave
User contributions licensed under CC BY-SA 3.0