Portable class library and GTK#

Hello,

I'm trying to work with a portable class library for my GTK# application. But whenever I try and use a class from my PCL I end up with the following error:

c:\Users\simon\Documents\testPortable\testGTK\MainWindow.cs(3,3): Error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. (CS0012) (testGTK)

I'm not really sure what's going on here? The PCL runs fine in my Xamarin forms android project.
My guess is my GTK# project isn't referencing the .net portable subset, but instead the standard .net library, but I'm not very sure what to do about it.

I'm running Xamarin 5.9.6. Let me know if you need more details.
Any pointers would be much appreciated, thanks!

I've attached the project files in the .rar file.

Answers

  • adamkempadamkemp USInsider, Developer Group Leader mod

    This is working when I try it. Which version of Xamarin Studio are you using?

  • This is working when I try it. Which version of Xamarin Studio are you using?

    Xamarin Studio 5.9.6. I'm also working on Windows 10 atm, maybe that's got something to do with it?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    Ah, it could. I tested on Mac using Xamarin Studio 5.9.7. I'll update my Windows Xamarin Studio to the latest and try there.

  • adamkempadamkemp USInsider, Developer Group Leader mod

    Ok, I tested on Windows with the same version of Xamarin Studio as you, and it still worked for me. Have you tried a clean build?

  • Thanks for letting me know. Yea, I tried a clean build and also tried to create a couple new projects, but it doesn't seem to make a difference.

  • adamkempadamkemp USInsider, Developer Group Leader mod

    Maybe try reinstalling? FWIW, I tested on a Windows 8.1 machine.

  • Seems to compile when switching the target .net framework of the PCL to '.net 4 or later' instead of '.net 4.5 or later'. However, then I believe won't be able to add the Xamarin forms package?
    The GTK# project is targeting Mono / .net 4.5. I'm assuming that's as it should be?
    @AdamKemp Which Windows version are you running?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    I answered that above. Do you not have a 4.5 runtime installed?

  • I actually think I do not. I'm pretty sure I've got the 4.6 runtime, since it's built into windows 10. But that also means windows doesn't allow me to install the 4.5 runtime. I'm gonna look into how to install .net 4.5 in windows 10.

  • This problem seems to have solved itself after installing Visual Studio (2015 community edition). I'm assuming something might've gone wrong in the Xamarin installation process.

Sign In or Register to comment.