Forum Xamarin Xamarin.Forms

Cannot add Active Directory Authentication Library Package to Xamarin.Forms and Droid application

Greetings everyone -

I am brand new to Xamarin and I am trying to jump right in. There is a post that I am trying to replicate ( and am having issues adding the NuGet package to both my Xamarin.Forms and Xamarin.Android applications. I am running PCL 4.5 - Profile 78 in my Xamarin.Forms project and the Droid project is targeting the latest installed platform (6.0) with an target android version of API Level 23.

When I attempt to add a reference to the "Active Directory Authentication Library" v 2.19.208020213, to either project, I am receiving an error to the effect of "Could not install package 'Microsoft.IdentityModel.Clients.ActiveDirectory 2.19.208020213'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+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."

Can anyone help me understand what I am doing wrong? The referenced tutorial makes it look so easy and I am stuck simply adding a reference.


Best Answer


  • MattSoloMattSolo USMember
    edited December 2015

    Thanks Matt! I was successfully able to get that package installed by using the following NuGet command in the console window. " install-package Microsoft.IdentityModel.Clients.ActiveDirectory -version 3.5.207081303-alpha"


    @mattward said:
    The Microsoft.IdentityModel.Clients.ActiveDirectory 2.19.208020213 NuGet package does not support Portable Class Libraries. In the blog post they are using Microsoft.IdentityModel.Clients.ActiveDirectory 3.5.207081303-alpha which is a pre-release, and does support Portable Class Libraries. To use the pre-release you can check the Show pre-release packages at the bottom of the Add Packages dialog.

    Unfortunately it looks as though the later pre-release versions do not support the profile of the portable class library you are targeting so you will have to use the Microsoft.IdentityModel.Clients.ActiveDirectory 3.5.207081303-alpha version. You can find that in the Add Packages dialog by running a version search:

    Microsoft.IdentityModel.Clients.ActiveDirectory version:*

    Any idea will/when Microsoft will release a new version that support Xamarin.Forms PCL project?

  • TaylorTaylor USMember ✭✭

    I would also like to get an answer to this

  • MStandifordMStandiford USMember

    I was able to add the latest stable release to my solution by jumping through the following hoops.

    • Create a new Xamarin.Forms Portable project
    • Right-click on the portable project and click Manage NuGet packages
    • Uninstall the Xamarin.Forms package
    • Right-click on the portable project and click Properties
    • Click the Change button under the Targeting section
    • Uncheck Windows Phone 8.1 and Windows Phone Silverlight 8 and click OK
    • Right-click on the portable project and click Manage NuGet packages
    • Add the latest stable Microsoft.IdentityModel.Clients.ActiveDirectory package (at this time 3.13.7)
    • Add the Xamarin.Forms package

    Hope this helps!

  • FactoryOptimizrFactoryOptimizr USUniversity ✭✭

    Thanks, @MStandiford - that seems to work. (...Though how you discovered that must have its own story!)

  • AndrewHerrickAndrewHerrick USMember ✭✭

    Thx @MStandiford worked perfectly!

  • timdelaneytimdelaney USUniversity ✭✭

    @MStandiford Thanks a lot! You saved my lunch hour.

  • DavidAllenDavidAllen USDeveloper Group Leader ✭✭✭

    Unfortunately, the Microsoft AD authentication team have done a bang up job of screwing up authentication support for mobile applications. It appears to be a recuring theme at Microsoft that authentication libaries are developed by teams with a web bias, and mobile is an afterthought (MSAL anyone? - what a joke, that team doesn't even seem to be able to read standards). This has resulted in this ADAL library being released without support for Windows Phone 8.1. Pathetic and unprofessional implementation from Microsoft yet again. MSAL is even worse - unreliable authentication on the iOS implementaiton, reliance on embedded Web Views, bugs all over the code in the Git repository, and almost non existant documentation. So, as @MStandiford says, you have to change the supported targets for your Xamarin.Forms PCL to remove any reference to Windows Phone and Silverlight.

Sign In or Register to comment.