userlond
userlond

Reputation: 3834

Xamarin Studio, GTK 2.0 C# application, runtime error, can't load libglib-2.0-0.dll

I've installed fresh Xamarin Studio 5.10 on Windows 7 and created standard GTK 2.0 C# project (via New Project > .Net > GTK#2.0 Project).

Code's below:

using System;
using Gtk;

namespace _test
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Application.Init ();
            MainWindow win = new MainWindow ();
            win.Show ();
            Application.Run ();
        }
    }
}

Build is ok, but runtime error raises (I've translated error from my native language into english):

Can't load DLL "libglib-2.0-0.dll": Procedure was not found (Exception from HRESULT: 0x8007007F)

Mono and gtk# seems to be installed ok via exes from official mono site. Test console app works ok.

May anybody help :) ?

Upvotes: 6

Views: 3202

Answers (5)

Ha ves
Ha ves

Reputation: 1

If this happens directly after you install GTKSharp for windows, restart Visual Studio.

Reason : the installer adds registry/environment variables and sometimes you need to restart either the Visual Studio or the PC.

Upvotes: 0

lindexi
lindexi

Reputation: 4357

Install the gtk sharp from https://www.mono-project.com/download/stable/ and the download link is https://xamarin.azureedge.net/GTKforWindows/Windows/gtk-sharp-2.12.45.msi

And then you should copy your gtk sharp dll to your output path.

Opening the C:\Program Files (x86)\GtkSharp\2.12\bin folder and copy the libglib-2.0-0.dll file to your output path.

Upvotes: 0

frummel
frummel

Reputation: 65

I had this problem in the following setup:

  • Windows Server 2012
  • Gtk# for .Net 2.12.38
  • Mono for Windows (x64) 4.3.2
  • Xamarin Studio 5.10.1

I replaced Gtk# for .Net 2.12.38 with Gtk# for .Net 2.12.30 which solved my problem.

Upvotes: 1

NaoNao
NaoNao

Reputation: 11

I had the same problem as the discussion topic points too, but I found the solution.

You might not select the .NET Runtimes as the Mono. You can see what .NET Runtimes is selected in Tools - Options - Projects - .NET Runtimes. There you can change the .NET Runtimes.

If you find only Microsoft.NET, you should get latest Mono at mono-project.com and install it. You will be able to select Mono Runtime.

Following post is very helpful.

How to debug in Xamarin Studio using mono runtime on Windows

Upvotes: 1

Santi Peñate-Vera
Santi Peñate-Vera

Reputation: 1186

You need to reboot. I just had the same problem and that was the solution.

Upvotes: 6

Related Questions