1

I am trying to build a project using Gtk#.

I have used Gtk# before, and I have always been using SharpDevelop for doing so.

Just that now ... it doesn't seem to work any more:

  • I have installed the latest release, Gtk# 2.12.26 for .NET, with the installer package from the Mono website, as I have formerly done with earlier versions.
  • I have created a C# command line application project in SharpDevelop, using C# 3.0 and targetting .NET 3.5.
  • I have added GAC references from my project to atk-sharp, gdk-sharp, glib-sharp, gtk-sharp, Mono.Cairo, and pango-sharp.
  • I have added using Gtk; into my main C# file.
  • When I write Gtk., SharpDevelop's IntelliSense will show all the types found in the Gtk namespace.
  • When I compile the project, the compiler aborts with the following message:

The type or namespace name 'Gtk' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

What am I missing?

This happens only when I target .NET 3.5. When I target .NET 4.0, I run into a different problem.

The complete output of the compiler (slightly anonymized) reads as follows:

Build started.
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Mono.Cairo". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "pango-sharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "gtk-sharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "gdk-sharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "glib-sharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "atk-sharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Compiling ...
...\Program.cs(3,7) : Error CS0246: The type or namespace name 'Gtk' could not be found (are you missing a using directive or an assembly reference?)
Build failed. (00:00:00.1930110)
Community
  • 1
  • 1
O. R. Mapper
  • 20,083
  • 9
  • 69
  • 114
  • I think the problem is that you have to target .NET 4.5 – Baltasarq Aug 19 '15 at 09:55
  • @Baltasarq: Do you have a reference for that? The [Gtk# website](http://www.mono-project.com/docs/gui/gtksharp/) doesn't seem to mention any specific .NET version (?) – O. R. Mapper Aug 19 '15 at 09:57
  • Unfortunately not. I only have the following quote: "Please upgrade your projects to Mono 4.5 (v4.5 in the csproj file). Mono 4 does not support anything smaller than .net 4.5." From a message in the mono-list: http://lists.ximian.com/mailman/listinfo/mono-list – Baltasarq Aug 19 '15 at 23:57
  • @Baltasarq: Hm. For some reason, I have gotten it to run on another computer now with .NET 4.0. So, the .NET 4.5 requirement doesn't seem to be accurate, or maybe it only applies to some bleeding edge version rather than the current public stable version? – O. R. Mapper Aug 20 '15 at 07:02
  • Don't really know. Can't help you further. – Baltasarq Aug 21 '15 at 10:14
  • Would anyone mind disclosing the reasons for the downvotes so I can improve the question? – O. R. Mapper May 09 '17 at 07:22

0 Answers0