Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mono gtk# - hello world deploy to windows

Tags:

windows

mono

gtk#

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

like image 265
matthias Avatar asked May 07 '13 10:05

matthias


1 Answers

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();
    }
like image 105
Zverev Evgeniy Avatar answered Nov 15 '22 07:11

Zverev Evgeniy