2
votes

I am building an application using GTK# 2.12 version. I installed MonoDevelop for that. Made a sample application. When I changed the setting from GTK#3 to GTK# 2.12 on the project then all references are updated to GTK#2.12.

When I am compiling the project then compiler throws an error.

/local/mnt/workspace/vkumbhan/work/Program.cs(25,25): Error CS0012: The type 'Application' is defined in an assembly that is not referenced. You must add a reference to assembly 'gio-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f'. (CS0012)

class MainClass
{
    public static void Main(string[] args)
    {
        Application.Init();     //error came this line
        MainWindow win = new MainWindow();
        win.Show();
        Application.Run();     //error came this line
    }
}

When I looked at the references for the Application class then I found it the Application refer to gtk-sharp 3.0.0.0.

For checking GTK# 2.12 installed or not.

apt-cache policy libgtk2.0-0 libgtk-3-0

both versions are installed on the machine.

Could you please help me, how to resolve the issue?

Find the command line: Please help to update references 2.12.0.0 instead of 3.0.0.0

/usr/lib/mono/msbuild/15.0/bin/Roslyn/csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG /errorendlocation /preferreduilang:en-US /highentropyva+ /reference:/usr/lib/mono/gac/atk-sharp/3.0.0.0__35e10195dab3c99f/atk-sharp.dll /reference:/usr/lib/mono/gac/gdk-sharp/3.0.0.0__35e10195dab3c99f/gdk-sharp.dll /reference:/usr/lib/mono/gac/glade-sharp/2.12.0.0__35e10195dab3c99f/glade-sharp.dll /reference:/usr/lib/mono/gac/gtk-sharp/3.0.0.0__35e10195dab3c99f/gtk-sharp.dll /reference:/usr/lib/mono/4.5-api/Mono.Posix.dll /reference:/usr/lib/mono/4.5-api/mscorlib.dll /reference:/usr/lib/mono/gac/pango-sharp/3.0.0.0__35e10195dab3c99f/pango-sharp.dll /reference:/usr/lib/mono/4.5-api/System.Core.dll /reference:/usr/lib/mono/4.5-api/System.dll /debug+ /debug:portable /optimize- /out:obj/Debug/Sample.exe /subsystemversion:6.00 /resource:gtk-gui/gui.stetic,gui.stetic /target:winexe /utf8output MainWindow.cs Program.cs Properties/AssemblyInfo.cs gtk-gui/generated.cs gtk-gui/MainWindow.cs "/tmp/.NETFramework,Version=v4.5.AssemblyAttributes.cs"

Thanks!

1
Edit your project file directly and replace all GTK related assembly references from 3.0.0.0 to 2.12.0.0.Lex Li

1 Answers

0
votes

The easiest way to solve this is to create a new Gtk# app in MonoDevelop, which defaults to Gtk# 2.12, since the designer needs that version.

Then you can copy the class files (*.cs) from the project that does not compile.