Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

PCLs won't build in Xamarin Studio for Mac

We're trying to get a simple proof of concept app working across iOS and Android with MvvmCross using a PCL for our viewmodels, but I'm having trouble getting PCLs to build on my Mac. I know PCL support is a little shaky right now, but we're starting a major new project for our company and we really want to give MvvmCross a shot.

I've replicated the problem with a brand new PCL project created from Xamarin Studio. In this case, the build fails with the following error:

/Users/josh/Workspace/Scratch/HelloPcl/HelloPcl/HelloPcl.csproj (Build) ->
    /Library/Frameworks/Mono.framework/Versions/3.0.12/lib/mono/4.0/Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->

   /Library/Frameworks/Mono.framework/Versions/3.0.12/lib/mono/4.0/Microsoft.Common.targets:  warning : Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.0,Profile=Profile3'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.

I'm on the Alpha channel, running Xamarin Studio 4.1.4, and I have Mono 3.0.12 set as my default .NET Runtime.

What can I do to try to troubleshoot this?



  • JoshEarlJoshEarl USMember

    Here's the error from the original project, which shows that we are using Profile104:

    (Build) ->
      /Library/Frameworks/Mono.framework/Versions/3.0.12/lib/mono/4.0/Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->
    /Library/Frameworks/Mono.framework/Versions/3.0.12/lib/mono/4.0/Microsoft.Common.targets:  warning : Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.0,Profile=Profile104'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.

    The app compiles and runs on Android from Visual Studio.

  • RomanKaganRomanKagan USMember ✭✭

    MvvmCross is great and I spent last days to recompile my project on mac also.
    So, the only solution is to download Mvvm Mac Binaries and create copy of PCL.csproj and change references.

    Here described more:

  • TheBearF8TheBearF8 USMember ✭✭

    Anyone from Xamarin Support!
    Has any changes been made to the PCL support especially for MvvmCross when using Xamarin Studio on a Mac. I know this was mentioned at the conference and that it would be forth coming. Do we have a date or timeframe yet.


  • MartinBauligMartinBaulig DEXamarin Team Xamurai

    This is because the Mono 3.0.12 that you're using didn't include the PCL Reference Assemblies yet. There will be a new preview release available shortly (probably early next week due to the US holiday).

  • JimOKeaneJimOKeane USMember
    edited July 2013


    I'm also finding it impossible to build mvvmcross tutorial projects (on OSX, Xamarin Studio).

    Even when trying to use the pre-built binaries from Stuart

    I'm currently using the Beta channel.

    Does anyone know the exact steps to fix this? Do I need to switch to Alpha channel?


  • CheesebaronCheesebaron DKInsider, University mod
    edited July 2013

    @JimOKeane MvvmCross binaries are always built with tools from the Stable channel.

    But you are not providing much information, so it is hard to tell exactly what is wrong, I suggest you create a question where you provide all the information you got. Errors, stack traces and reproducible steps.

  • deapsquatterdeapsquatter USBeta ✭✭

    @baulig did yesterdays update include the PCL Reference Assemblies? I still cant compile a File/New PCL Project without getting

    /Library/Frameworks/Mono.framework/Versions/3.0.12/lib/mono/4.0/Microsoft.Common.targets: Warning: Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.0,Profile=Profile1'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior. (PortTest)

  • JimOKeaneJimOKeane USMember

    I'm seeing the same problem(s) as JoshEarl. This is why I replied to this thread.

    I'm trying to take the Tutorial solutions, load and build them in Xamarin Studio running on OSX. But it appears that the PCL stuff doesn't work with Xamarin Studio...

    I'd love to use MvvmCross, but I'm having a devil of a time getting it setup.

  • RupertRawnsleyRupertRawnsley GBMember ✭✭✭

    Me too. I upgraded to both Beta and Alpha channels and I'm getting the same behaviour. The Alpha version was Mono Framework MDK 3.0.12.

    The reproduce is trivial for me: New Solution, New PCL Project, Compile, Error (i.e. nothing to do with MvvmCross).

    I assume we have to wait for the new MDK, as suggested by @baulig

  • RomanKaganRomanKagan USMember ✭✭

    same as Rupert

  • deapsquatterdeapsquatter USBeta ✭✭

    All working now with downloads from last night. Working meaning I can create a File/New Portable Library and it compiles out of the box.

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    Just verified that Microsft's portable HttpClient library with async/await can be used in Xamarin Studio PCL libraries and consumed from Xamarin.iOS projects using latest Alpha channel versions.

    Yay, today I was coding the communications layer for one of my projects and this made my day.

  • deapsquatterdeapsquatter USBeta ✭✭

    @GuillermoGutierrez which System.Net.Http.dll are you using from the nuget packages folder? Cant seem to get one that works.

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    @deapsquatter Yes, the latest prerelease NuGet package available: Microsoft.Net.Http 2.2.10-rc

  • deapsquatterdeapsquatter USBeta ✭✭
    edited July 2013

    From which folder?

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    portable-net45 . You need .NET 4.5 for native async/await in PCLs . I setup the PCL with .Net + WP8 (Profile49)

    If you can, I'd recommend you installing from NuGet in VS, because there are some dependencies. After that. I switched back to Xamarin Studio on Mac and worked flawlessly :D

    Attached the super-simple project that I setup to check if it worked.

    Now I'm checking if the async/await version of JSON.Net also available as a prerelease NuGet package works as expected.

    Un saludo!

  • deapsquatterdeapsquatter USBeta ✭✭

    Brilliant thanks. All working.

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    Just noticed that using any profile other than Profile49 won't let you add System.Threading.Tasks and thus no async/await support.

    So stick to that by now.

    Sadly this change broke many of my reflection methods :(

  • RupertRawnsleyRupertRawnsley GBMember ✭✭✭

    Working for me as well now thanks to @GuillermoGutierrez's awesome advice.

    I had to dump my TinyIoC code because of differences in the Reflection API between .NET 4.0 and .NET 4.5 for PCLs. For full .NET it appears the legacy API remains, but for the PCL version it does not. My needs are modest, so I've replaced it with a simple hand-coded version, but there is an apparent gap in the market for a .NET 4.5 PCL friendly IOC container.

    On the bright side, async on iOS and Android! This is going to be a huge productivity enhancer.

  • RomanKaganRomanKagan USMember ✭✭

    When I create simple PCL I get warning
    /Library/Frameworks/Mono.framework/Versions/3.0.12/lib/mono/4.0/Microsoft.Common.targets: Warning: Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.0,Profile=Profile1'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior. (Test4)

    and 31 errors. Now I will try to change manually profile number

  • RupertRawnsleyRupertRawnsley GBMember ✭✭✭

    I forgot to say that it still doesn't work out-of-the-box (a default PCL project). I had to select the relevant platforms I wanted (none of which were ticked). For instance: .NET Framework 4.5 + Windows Phone 8 + Xamarin.Android + Xamarin.iOS

  • RomanKaganRomanKagan USMember ✭✭
    edited July 2013

    Do I have to change something in Xamarin settings? When trying to compile sample HttpClientPortable or any PCL with mono3.0 with different profiles or frameworks I still get same warning:
    /Library/Frameworks/Mono.framework/Versions/3.0.12/lib/mono/4.0/Microsoft.Common.targets: Warning: Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.5,Profile=Profile49'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior. (HttpClientPortable.Core)

    and same errors:
    /Users/RoX/Projects/Http/HttpClientPortable.Core: Error CS0518: The predefined typeSystem.Object' is not defined or imported (CS0518) (HttpClientPortable.Core)`

    and I don't have same options:

    just .Net framework 4, Silverlight 4, Windows Phone 7 and Xbox360

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    @RomanKagan Are you using latest Xamarin Studio from Alpha channels? If so, download the sample that I attached in my previous posts and check it out. It should work.

  • RomanKaganRomanKagan USMember ✭✭

    @GuillermoGutierrez, I use Alpha, and I've downloaded your sample - the warning and errors are from its compilation. Actually, I even don't see 4.5 .Net target framework option, do I need to define it?

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    @RomanKagan I'd recommend you reinstall Xamarin Studio for Mac from using the latest versions from Alpha channel, because it seems that your XS version is not updated.

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    I got the same sample working with Profile158 (.net45, sl5, wp8 & windows store) by adding a reference to Async NuGet package (Microsoft.Bcl.Async).

    This way the reflection API doesn't change. Attached same sample with this new profile, compiles and runs from both VS2012 and XS for Mac.


  • OysteinKrog_InitialForceOysteinKrog_InitialForce NOMember ✭✭
    edited July 2013

    What version of Xamarin Studio are you guys running?

    I'm having the same problem as @RomanKagan (don't see 4.5 .Net target framework in project options).

    I'm running Xamarin Studio 4.1.6 (build 2) and I've tried to reinstall with no changes.
    I am ofcourse using alpha channel.

    When I try to compile the projects which have been posted here I get a lot of errors related to missing references to system types.

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    @OysteinKrog I'm running latest version from Alpha channel, 4.1.6 (build 2). Maybe someone from Xamarin team may help you with that :/

  • RomanKaganRomanKagan USMember ✭✭

    I reinstalled, and it still doesn't work

    my settings are

    === Xamarin Studio ===

    Version 4.1.6 (build 2)

    Mono 3.0.12 ((no/d6c5db8)
    GTK 2.24.18
    GTK# (
    Package version: 300120000

    === Apple Developer Tools ===

    Xcode 4.6.3 (2068)
    Build 4H1503

    === Xamarin.iOS ===

    Version: (Business Edition)
    Hash: b7e6b95
    Build date: 2013-03-07 10:27:05-0400

    === Xamarin.Mac ===

    Xamarin.Mac: Not Installed

    === Operating System ===

    Mac OS X 10.8.4

  • OysteinKrog_InitialForceOysteinKrog_InitialForce NOMember ✭✭
    edited July 2013

    I installed the latest alpha today (with mono 3.1.2) and I now have all these options.

    I suspect you guys were able to get the mono 3.1.1 alpha release before it was pulled, and me and RomanKagan were stuck trying to get it working with mono 3.0.2.

  • RomanKaganRomanKagan USMember ✭✭

    It works with 3.1.2
    Thank you, Guillermo and Oystein! Let's async

  • RomanKaganRomanKagan USMember ✭✭

    Have you succeed to compile project with MvvmCross commands in Profile158?

    I got
    Error CS1684: Reference to type System.Windows.Input.ICommand' claims it is defined assemblySystem, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes', but it could not be found (CS1684)

    edited July 2013

    Thank you for sample - it helped a lot.
    I was able to compile a run under XS & VS.
    It works just great under XS (MAC) but under Visual Studio I'm getting the following error:

    Unhandled Exception:
    System.PlatformNotSupportedException: This platform is not supported.



    I changed it with await but got the same result.
    I updated to ALPHA channel (XS 4.1.6 b2 & VS.iOS 1.2.121) and expect that Tasks support & await / async will be supported by VS & XS.

    What could I fix here?

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    @CTPAX I just downloaded the sample and compiles in Visual Studio without any changes.

    @RomanKagan Yes, I have already one complete project fully working in Profile158 with latest MvvmCross NuGet Package from Stable channel. It compiles and runs (with some minor special characters flaws) in both XS and Visual Studio.

    I had some issues when switching from Visual Studio to Xamarin Studio because they share the same folder, so I had to manually delete obj and bin directories. Apart from that, it's working correctly.


    @GuillermoGutierrez thank you for try. I can compile it as well. Try to launch it under Visual Studio.

    Regarding stable channel: do you use there Tasks & await/async ?

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    @CTPAX I use Visual Studio as my main development environment, I'm pretty sure it also works there. Make sure your Mac host is running latest Alpha and do the same in Visual Studio. Then, try resynchronizing Visual Studio with your Mac host to update the Xamarin.iOS SDK in VS.


    @GuillermoGutierrez still no luck. Under Visual Studio I got the following:
    Unhandled Exception: System.PlatformNotSupportedException: This platform is not supported.

    Could you please debug attached solution under Visual Studio and confirm that it works fine (before you said that it compiles but it compiles for me as well).

    I have reinstall completely Xamarin under Windows and switched to Alpha channel.
    I have updated Xamarin components under iOS by switching to Alpha channel.

    Then I started Visual Studio and tried to debug solution attached above and was asked to synchronize SDK. But I just switched BOTH (Windows & iOS) SDK to Alpha channel.

    What is going on here?

    Thanks for any suggestions. I spent several weeks trying to launch async/await+tasks+pcl code under Visual Studio with Xamarin iOS plugin and still have no luck.

    Alexey Strakh

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    @CTPAX I just double checked that I can compile, run, debug, step-by-step debug and even variable inspection (this one is rather buggy yet) using VS2012 pro. I've tested it in three machines and works in all of them.

    Sorry, but I cannot help you further, maybe some guy from Xamarin Team may help you to decipher what that error means.

  • PCL broken yet again in Mono 3.2.0...

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    async/await and PCL support is now on stable channel!

Sign In or Register to comment.