Bug 43198 - Unable to add reference to a PCL Project Targeting .NET Standard
Summary: Unable to add reference to a PCL Project Targeting .NET Standard
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 4.1.2 (C7SR1)
Hardware: PC Windows
: Normal normal
Target Milestone: 4.2.1 (C8SR1)
Assignee: Bugzilla
Depends on:
Reported: 2016-08-09 17:18 UTC by Dan Rigby
Modified: 2017-04-20 08:39 UTC (History)
8 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dan Rigby 2016-08-09 17:18:51 UTC
If you create a new Portable Class Library project and convert it to target .NET Standard (I tested using .NET Standard 1.4), you cannot add a reference to the PCL project from a Xamarin.Android or Xamarin.iOS project.

The error received is "Unable to add a reference to project '<PclProjectName>'. The current project's target is not one of or compatible with the targets of Portable Library project '<PclProjectName>'."

Manually adding the reference by editing the CSProj file causes a warning in the VS errors window, however compilation is successful and no runtime errors are discerned.

Copying the `Xamarin.Android.xml`, `Xamarin.iOS.Unified.xml` and `Xamarin.iOS.xml` files into the 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v5.0\SupportedFrameworks' folder and restarting Visual Studio appears to resolve this issue. (Not sure if this is the appropriate fix)

Version Information:
XVS Version (fcbe082)
Visual Studio Version 14.0.25425.01 Update 3
Comment 1 Guillaume R 2016-08-22 12:09:13 UTC

I have exactly the same issue, which prevents me to compile any Xamarin.Forms PCL blank project on Android or iOS.
However, I am able to compile and deploy Android standalone blank projects.

As Dan suggests, I have opened the <PclProjectName>.csproj file, as well as the <PclProjectName>.Droid.csproj and <PclProjectName>.iOS.csproj, but I begin with Xamarin and VS and I could not figure out how to modify it to include the reference to the project <PclProjectName>. Could you please give more explanation about this ?

The workaround suggested does not work on my configuration. 

I am using also 
Visual Studio Version 14.0.25425.01 Update 3
(all this information provided in VS -> Help -> About Microsoft VS, therefore VS should be detecting everything.)

Thank you for your help
Comment 2 Daniel Cazzulino 2016-08-24 02:13:55 UTC
Does it work if you switch to a regular PCL profile, add the reference, and then switch back the PCL to NETStandard?
Comment 3 Daniel Cazzulino 2016-08-25 17:02:01 UTC
I've tried with a clean VM, with VS2015 Update 3, Xamarin 4.2.x (cycle8/current beta/alpha) and the instructions at https://oren.codes/2016/07/09/using-xamarin-forms-with-net-standard/ and it worked just fine.

Please reopen if that's not the case.

Comment 4 Simon Chopin 2016-10-12 08:24:51 UTC
I'm having the same problem here, with a simple Xamarin.Android project and the current beta release ( as well as the current alpha ( ???). Adding the dependency manually in the csproj did the trick, although it doesn't even show up in the references.
Comment 5 Simon Chopin 2016-10-12 08:29:09 UTC
Scratch that last part about the references, it was only a copy-pasta fail for me in the name of the ref. It does show up with a warning.
Comment 6 Tamer 2017-03-20 08:26:35 UTC
Hi, i have the same problem now, i converted the PCL to standard and now i'm not able to build the Android project i removed the PCL and tried to added it again and it gives me the error that i can't add this PCL because it's not from the compatible targets, is there a solution to this one that works.
Comment 7 Ryan Dixon 2017-04-20 08:39:49 UTC
Anyone else still able to reproduce this on Visual Studio 2017?
If I simply create a new xamarin forms project and add and convert a forms class library to netstandard 1.4, appending the imports tag "portable-net45+wpa81+wp8+win8" then I am still getting this error.