Forum Cross Platform with Xamarin 2017 Convert PCL Xamarin Forms to .NET Standard

There's a ton of blog posts saying this works but I can't for the life of me figure out how. It just blows up and doesn't recognize XAML files etc.

Is there any new guidance on how to make this work? Given the current state of dependencies all going to .net standard it's getting increasingly important that this works properly.


  • bump

  • jmccormickjmccormick USMember ✭✭

    @JamesHancock.1360, did you ever get this figured out?

  • mikeacostamikeacosta USUniversity ✭✭✭

    If you haven't already, add this to the PCL's csproj file - change TargetFramework accordingly.

    Also, I had problems with 1.5, changed to 1.4 and that's works pretty well.

  • JamesHancock.1360JamesHancock.1360 USMember ✭✭

    @mikecosta When I do that none of the XAML files are recognized in the PCL anymore and it doesn't nest the .cs files for the XAML. It sort of works but not really.

  • mikeacostamikeacosta USUniversity ✭✭✭

    @JamesHancock.1360 Not .csproj, I was thinking of a .NET Standard Library project.

    For your Xamarin cross-platform sol'n, project.json file should look something like this:

      "supports": {},
      "dependencies": {
        "Xamarin.Forms": "",
        "NETStandard.Library": "1.6.0",
        "Microsoft.NETCore.Portable.Compatibility": "1.0.1"
      "frameworks": {
        "netstandard1.4": {
          "imports": "portable-win+net45+wp8+win81+wpa8"

    Make sure all projects ref the latest Xamarin.Forms version. Try deleting the PCL obj and bin folders, then doing a clean and build.

  • JamesHancock.1360JamesHancock.1360 USMember ✭✭

    I'm using CSProj with similar settings and it ignores the XAML files still.

  • mikeacostamikeacosta USUniversity ✭✭✭

    You need to modify project.json.

  • BrainCreatorBrainCreator USMember

    please use this guide - it's totally working

  • JamesHancock.1360JamesHancock.1360 USMember ✭✭

    Awesome! Thanks!

  • DenisBarnardDenisBarnard USMember ✭✭

    Please post your experience on this when you can.
    I have attempted this once and it ended up being a complete waste of time as it simply was not ready (despite the guides).

    I am hopeful that perhaps progress has been made since then?

  • c-zc-z DEMember ✭✭

    @BrainCreator said:
    please use this guide - it's totally working

    I tried this and the XAML Page and C# will now be displayed correctly in Visual Studio, but I still get the error that the method InitializeComponent() is not available in the current context. Nevertheless, the build is successful.

    Do you have the same problem?

  • JKayJKay USMember ✭✭✭

    Anyone know if that guide works?

Sign In or Register to comment.