PCL in Xamarin Studio

olloollo PLMember

Hi,

I have problem with configure Portable Class Library support on Xamarin Studio. It seems like some profiles in Project Options->Build->General are missing. I cannot set Target Frameworks for Android, iOS and Windows Phone in the same time.
As I saw in 'Introduction to Portable Class Libraries' there should be possible. What system component is responsible for target profiles?

I spent a lot of hours to make PCL working in Xamarin Studio. I try to configure PCL in Xamarin Studio without installing Visual Studio (any version). I wonder if it's even possible?
What I've done till now:

  1. Installing Xamarin for Windows /starter edition/ (Xamarin Studio 4.2.2, Xamarin.Android 4.10.1)
  2. Installing Mono MDK (http://download.mono-project.com/archive/3.2.3/windows-installer/mono-3.2.3-gtksharp-2.12.11-win32-0.exe)
  3. Installing PortableLibraryTools.exe (with /buildmachine argument)
  4. Installing NetFx_PortableLibraryReferenceAssemblies46.exe
  5. Installing .NET 4.5 framework
    I'm not quite sure about order, because I tried a lot of possiblities.

How to configure Xamarin Studio (starter) to use PCL for Android,iOS and Windows Phone? (What system components should be installed)

Thanks in advance!

Posts

  • mhutchmhutch USXamarin Team Xamurai
    edited January 2014

    To get PCL support in XS for Windows, you need PortableLibraryTools.exe (with /buildmachine). It doesn't matter when you install it.

    The complication comes in getting PCL support for Xamarin.Android projects. For this, you have to install Xamarin.Android after PortableLibraryTools, so Xamarin.Android can install its SupportedFramework files into the PCL frameworks.

    You don't need to reinstall Xamarin Studio, .NET framework, etc.

    Sorry it's not documented better. We're looking into making this easier.

  • mhutchmhutch USXamarin Team Xamurai

    Note that there isn't much point to installing NetFx_PortableLibraryReferenceAssemblies46.exe, it only installs a zip file of the assemblies, it does not install the assemblies or MSBuild targets required to use them.

  • olloollo PLMember

    So what about:

    ' If you are using Xamarin Studio for Windows you will need to install the latest Portable Library Reference Assemblies from Microsoft. '

    It's from 'Introduction to Portable Class Libraries'.

    I uninstalled Xamarin.Android and PortableLibraryTools, and installed first PortableLibraryTools and next Xamarin.Android. But unfortunately it wasn't help.
    At the moment I'm uninstalling everything (.NET framework, Mono and so on) and will try to do fresh install.

    Could you write what exactly need to be installed (with proper order) to make PCL working in Xamarin Studio?

  • olloollo PLMember

    After reinstalling all components still the same - in any profile I can't set Android,iOS and Windows Phone simultaneously. Missing some profiles?

    What I've installed in order:

    1. .NET framework 4.5.1
    2. Mono MDK
    3. 'PortableLibraryTools2 for Visual Studio 2010' (with /buildmachine)
    4. NetFx_PortableLibraryReferenceAssemblies46.exe
    5. Xamarin for Windows (Windows 7 Home Premium 64bit)

    I'm quite new in .NET world, so maybe there is something obvious what I'm doing wrong.
    What else could I check to be sure if all necessary components are installed correctly?

  • mhutchmhutch USXamarin Team Xamurai

    Yes, sorry about the problem with the docs. I have asked our docs team fix it.

    So you're now able to create PCL project and see the profile list in the project options - what profiles and platforms do you see there?

    When you say you installed Xamarin for Windows do you mean Xamarin Studio, Xamarin.Android, or the unified installer? If you're using the unified installer you should be aware that it won't reinstall things that are already installed.

  • olloollo PLMember

    No problem. PCL is new in Xamarin - all begginings are difficult.

    Yes I'm able to create PCL project, but I can't set Android,iOS and Windows Phone together/simultaneously.
    So after creating Portable Library:

    I have these targets (profile 136 missing?):

    And these profiles:

    Xamarin for Windows means for me unified installer. I couldn't find Xamarin.Android standalone installer.
    First I uninstalled just Xamarin.Android and execute unified installer. Next try was with uninstalling all Xamarin components and all .NET components. Results are above.

    Thanks in advance for any help or hint.

  • mhutchmhutch USXamarin Team Xamurai

    Not sure why Profile136 shows 'not installed' when it and all the other frameworks seems to be enumerated correctly.

    Does the directory C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile136 exist and contain assemblies?

    I think XS and XI are not marked as compatible with any of the PCL profiles that are compatible with Windows Phone 7 and 7.5. If you change Windows Phone to 8, you should be able to get a profile e.g. 4.5 Profile78 or 4.0 Profile 158.

  • olloollo PLMember

    No, this directory doesn't exist at all. Do you think that copying this directory from other machine could help? Could you maybe copy this Profile136 directory from your machine and upload it?

    By XS you mean Xamarin Studio and XI means Xamarin.iOS?

    I will try to check this also on Windows 8. As I understand WindowsPhone8 development is only possible on Win8 machine? There is no possibility to have PCL assemblies for Windows8Phone on Win7 machine, is it?

    Ok, the last question: could you write what components need to be installed to have PCL support in Xamarin Studio on Windows?

  • olloollo PLMember

    So it seems to work. Great!

    I've go with your proposed solution, and I have more profiles now. I can set targets for Android, iOS and WindowsPhone(also ver 8) in one solution. That's what I wanted.

    Possibility for using PCL profiles for WindowsPhone8 is really good news. Unfortunately after choosing profile with WindowsPhone my app is too big for Starter edition - but sooner or later this day had to come.

    From my experience I know such issues (especially with development tools) occurs quite often. But for every problem there is some solution :)

    Thanks very much for professional help!

  • KevinNewmanKevinNewman USMember ✭✭

    I'm having a similar issue as this except on Mac. I have a Xamarin.Android license, but not Xamarin.iOS license. This is what I'm getting:

    I've switched from all the dev channels a few times, so I'll try to reinstall Xamarin and see if that helps.

  • KevinNewmanKevinNewman USMember ✭✭

    I reinstalled Xamarin Studio (deleting Xamarin Studio from Applications didn't uninstall Xamarin.iOS or Xamarin.Android - not sure how to do that). It changed the problem, which now looks like this:

    unfocus.com/Xamarin-Forums/BadPCL2.png

    There's no "Current Profile" like there was before (and like the screenshots in the tutorials show), and nothing is ever added to the References folder.

    It seems to build though.

  • mhutchmhutch USXamarin Team Xamurai
    edited April 2014

    Please check you have the Mono MDK, not the MRE.

  • sandeep.2569sandeep.2569 USMember

    I face same as show upload image.i resolve it by unstalling xamarin then NetFx_PortableLibraryReferenceAssemblies46.exe install and after it reinstall xamarin .

  • Same issue

    'Xamarin.Forms 1.3.1.6296' already installed.
    Adding 'Xamarin.Forms 1.3.1.6296' to Jpost.
    Could not install package 'Xamarin.Forms 1.3.1.6296'. You are trying to install this package into a project that targets 'portable-net45+sl50+MonoAndroid10+xamarinios10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

    updated nuget, done this also
    Install PLT2
    Install PLRA
    Extract the PLRA PortableReferenceAssemblies.zip (from C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6\PortableReferenceAssemblies.zip) into the PCL reference assemblies directory C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable.

    re install xamarin, still happens.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai
    edited January 2015

    @ adyshimony.5386, the following articles might help:

    If those articles don't solve the problem, since this thread is quite old, I'd recommend to start a new thread (feel free to link to include a link to this old thread in the new thread). Be sure to file your new thread under "Visual Studio" if you're using Visual Studio or under "Xamarin Studio" if you're using Xamarin Studio. If you have a Business license or higher, feel free to email Xamarin support using one of the contact emails on https://store.xamarin.com/account/.

    I will close this thread for now since it has been inactive for almost 1 year.

This discussion has been closed.