4

I had some monodevelop programs with a GTK# user interface running smoothly in ubuntu 11.04 without unity. I have upgraded to ubuntu 11.10 with unity. Now I get the following error:

"The type or namespace name 'Gtk' could not be found. Are you missing an assembly reference?".

And indeed in my references the references atk-sharp, gdk-sharp, glade-sharp, glid-sharp, stk-sharp and pango-sharp are colored red and I can't re-add them.

If I search in the software to install at gtk-sharp then it tells me Gtk# 2.10 is installed. If I start a new gtk project in monodevelop it gives the same errors.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Paul
  • 678
  • 10
  • 15

2 Answers2

4

This issue is due to Mono runtime version. Please change Mono runtime version of the project from Mono/.NET 3.5 to Mono/.NET 4.0 to fix this issue.

For this, please follow the steps as given below:

  1. Launch 'Project Options' dialog using Solution Explorer.
  2. Select 'General' project settings available under 'Build' group
  3. Change Runtime version to Mono/.NET 4.0.
  4. MonoDevelop will upgrade the current project as Visual Studio 2010 equivalents. Then, Rebuild the project and verify the outcome.
Karthick Arun
  • 301
  • 2
  • 7
  • @Karthick, I followed the exact instructions in your answer, and I am experiencing the exact same issue as Paul, but your method did not wrok for me unfortunately. When I create a new Solution (GTK# 2 C# Project) and without making any changes to code, it gives me the same issue as Paul. I have made sure that Mono runtime version is set to Mono/.NET 4.0.Any ideas? – Tommy Feb 14 '13 at 00:31
  • 1
    Nevermind :) I just solved it. In Fedora, you need to install more things. Run yum install gtk-sharp2-devel under root at the command prompt. – Tommy Feb 14 '13 at 00:52
2

In my case solution was installing GTK# libraries. For Debian based distros GTK# could be installed as

sudo apt-get install gtk-sharp2

Or if you are using a RedHat based distro,

yum install gtk-sharp2-devel

See Tommy's comment above.

Abdullah Leghari
  • 2,332
  • 3
  • 24
  • 40