cvanbeek
cvanbeek

Reputation: 1961

Error installing System.IdentityModel.Token.Jwt in Xamarin.Forms

I'm trying to use the System.IdentityModel.Token.Jwt NuGet package for my Xamarin.Forms app. When I try to add the package to my PCL, it installs in my Android and iOS projects, but I get the following error when adding it to the shared code project:

Could not install package 'System.IdentityModel.Tokens.Jwt 5.1.3'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile44', 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.

Does anyone know how to get around this? I think it has to do with what my project targets but I've tried a few combinations and all of them have produced the same error, just with a different profile listed.

Upvotes: 3

Views: 1017

Answers (1)

Matt Ward
Matt Ward

Reputation: 47987

Unfortunately the System.IdentityModel.Tokens.Jwt 5.1.3 NuGet package only contains assemblies that support:

  • .NET Framework 4.5.1
  • .NET Standard 1.4

No portable class library profile supports .NET Standard 1.4. The highest they support is .NET Standard 1.2.

So unless you can find another NuGet package that does support portable class libraries you are left with trying to compile the Jwt source code for the portable class library profile you need, or converting your portable class library project into a .NET Standard project and target at least 1.4. You should be able to convert your portable class library project into a .NET Standard project in the project options.

Upvotes: 3

Related Questions