AlexanderRD
AlexanderRD

Reputation: 2089

Xamarin Studio reports Mono.Unix namespace not found when using GTK#

I am trying to create a GTK# application in Xamarin Studio so I have created a GTK# solution it generates the following code using the editor

error tooltip

As shown it shows an error saying that

"Mono" could not be found.

I also use Unity so that may be affecting Mono.

Upvotes: 3

Views: 1226

Answers (2)

user1623521
user1623521

Reputation: 338

The error is a bit misleading, it doesn't mean that Mono is not found but that the namespace "Mono.Unix" is not found. This namespace can be found in the assembly Mono.Posix, please add a reference to it and try to compile again.

Upvotes: 2

SushiHangover
SushiHangover

Reputation: 74134

I've had the same thing happen to me on the OS-X version of Xamarin Studio, but I could not tell you how to reproduce it (and the exact solution).

And you will basically get the same error via building with xbuild as the generated gtk/MainWindow.cs is not correctly generated but is included during the MSBuild "Target CoreCompile" step thus resulting in:

MainWindow.cs(8,3): error CS0103: The name `Build' does not exist in the current context

What has solved it for me was to:

  • Set the project to NOT use MSBuild
  • Exit and restart Xamarin Studio
  • Clean All
  • Build All
  • If needed, set the project back to using MSBuild.

Upvotes: 0

Related Questions