When you have a Portable Xamarin project in Visual Studio 2015 and you try to add the NuGet package for ADAL (Microsoft.IndentityModel.Clients.ActiveDirectory) it is possible you will receive an error complaining that the package does not contain any assembly references which are compatible with the targets of your PCL project. The error will be something like this.

“Error Could not install package ‘Microsoft.IdentityModel.Clients.ActiveDirectory 3.13.1’. You are trying to install this package into a project that targets ‘.NETPortable,Version=v4.5,Profile=Profile111’, 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.”

It seems that this is caused by the fact that one of the targeting platforms of your PCL is Windows Phone 8.1. ADAL does not support Windows Phone 8.1. Only removing the Windows Phone 8.1. project from your solution will not do the trick. You still need to remove this target from the PCL project inside your solution.

The following steps explain how to resolve this issue.

Right click on your PCL project and open “Properties”. Go to the tab “Library”. You will notice a list of targeted platforms.

ErrorinstallingADALpackageinpcl2

If you now would change the targeted platforms by removing the target Windows Phone 8.1 you would get an error.

ErrorinstallingADALpackageinpcl3

The problem is that you will not be able to uncheck that specific target before you have removed installed NuGet packages from the PCL project. Right click on the PCL project and select “Manage NuGet packages..”. Make sure you write down which packages are installed before uninstalling them. Uninstall each of the installed packages.

Now again go to the properties of the PCL project and the tab “Library”.

ErrorinstallingADALpackageinpcl2

Press the button “Change” and uncheck the target “Windows Phone 8.1”. Press the “OK” button. Wait a few seconds and the dialog will be gone and the target is removed from the PCL project.

Now you are ready to finalise it by reinstalling each of the uninstalled NuGet packages for the PCL project and install the ADAL NuGet package.

ErrorinstallingADALpackageinpcl5

And there you have it! Your ADAL NuGet package is now installed for your PCL project.

Previous articleI’m speaking at Collab 365 Global Conference 2016
Next articleMy first encounter with HoloLens
A professional which inspires, motivates and educates businesses on how to leverage emerging technologies using Virtual, Augmented and Mixed Reality in their journey to digital innovation. He has a strong background on SharePoint, Office 365 and Microsoft Azure and is working with machine learning, artificial intelligence and cognitive services. Primarily focused on manufacturing, construction, industry, logistics and maritime/offshore, his goal is helping businesses to achieve more on creating, improving, smartening and shortening of business processes by using services, apps and devices. Furthermore, he engages in speaking, blogging and is organizer of events like the Mixed Reality User Group, Mixed Reality Talk @ VR, SP&C and the Global AI/MR Bootcamp. With more than 20 years of IT Business experience, acting in different roles like solution architect, he believes the future is just starting! Highly experienced in all realities, HoloLens and other devices, User experiences on devices and connecting the world to the cloud will help him to shape that future!

LEAVE A REPLY

Please enter your comment!
Please enter your name here