I Cant Install Microsoft.Identity.Client In Xamarin.Forms - c#

I Try to Install Microsoft.Identity.Client Nuget to my Xamarin.Forms Project. But every time i try to install the package I always get this error message:
Could Not install package ' Microsoft.Identity.Client 1.0341221-alpha'. You are trying to install this Package into a project
that targets '.NetPortable,Version=v4.5,Profile=Profile259, but the package does not contain any assembly references or content files that are compatible with that framework for more iformation, conct the package author
What should I do here, I have already tried all version of the package, and try to install the package from Package Manager Console

The error is very clear, the NuGet does not contain any target platforms that are supported in your PCL profile 259.
You should migrate your PCL to a .NET Standard library, at least version 1.1 to consume the NuGet package in your shared code. Alternatively, you could abstract it away with an Interface and Dependency Injection, which probably will be more time consuming.

Related

Cannot update nuget package (PCL)

I'm getting this error when using maps in Android:
System.MissingMethodEsception: Method
'Xamarin.Forms.maps.Android.MapRenderer.OnCameraChange' not found.
And I've read that you can update the nugetpackage to fix the issue. However, I cannot install it due to this:
Could not install package 'TK.CustomMap 2.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', 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.
The updates of packages installs just find in iOS and Android but not for PCL. I've tried to remove all the packages and then tried to add TK.Customs nuget package but this same issue.
Also tried to install it on a fresh project and that installed just fine. Just cant get it to install on my old project.
Here is the whole error message when trying to update package:
Attempting to gather dependency information for package 'TK.CustomMap.2.0.1' with respect to project 'Vernamo', targeting '.NETPortable,Version=v4.5,Profile=Profile78'
GET https://api.nuget.org/v3/registration3-gz-semver2/tk.custommap/index.json
OK https://api.nuget.org/v3/registration3-gz-semver2/tk.custommap/index.json 175ms
Total number of results gathered : 29
Gathering dependency information took 232 ms
Summary of time taken to gather dependencies per source :
https://api.nuget.org/v3/index.json - 204.03 ms
Attempting to resolve dependencies for package 'TK.CustomMap.2.0.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'TK.CustomMap.2.0.1'
Resolved actions to install package 'TK.CustomMap.2.0.1'
Found package 'TK.CustomMap 2.0.1' in '/Users/holger/Downloads/Vernamo/packages'.
For adding package 'TK.CustomMap.2.0.1' to project 'Vernamo' that targets 'portable45-net45+win8+wp8'.
Install failed. Rolling back...
Package 'TK.CustomMap.2.0.1' does not exist in project 'Vernamo'
Executing nuget actions took 52 ms
Could not install package 'TK.CustomMap 2.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', 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.
The pre-release version (at least pre2) of TK.CustomMap supported all platforms (see here), anyway, as of pre3 (see here), obviously the support for all platforms was dropped in favor of .NET Standard (1.1 in this case).
The profile you are using in your PCL does not seem to be compatible with .NET Standard 1.1, hence NuGet fails to add the reference. You may try to switch to another profile (.NET 4.5.1 for example), but I don't know if that would help. Another option would be to migrate your projects to .NET Standard. It's kind of a stupid, repetetive task, but it's possible.

Cannot update Microsoft.Extensions.Logging to (2.0) Mono Develop 6.1.4

My packages in my project indicated there was a version update to 2.0 for:
Microsoft.Extensions.Logging
NETStandard.Library
Microsoft.NETCore.Platforms
The only one I cannot get to update is Microsoft.Extensions.Logging
The Error I get is this:
Package 'Microsoft.Extensions.Logging 2.0.0' does not exist in folder '/home/MyUser/UpdatedPon/pon/sbmanager/packages'
Could not install package 'Microsoft.Extensions.Logging 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', 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.
I have been searching the internet the past few days looking for a solution, but I have not found one as of yet.
Has any one ran into this issue, I am running MonoDevelop 6.1.4
and my MONO version is 5.2.0.215.
Lastly this is a WebForms application.
The Microsoft.Extensions.Logging 2.0.0 NuGet packages has assemblies for .NET Standard 2.0.
A more recent version of NuGet is required for .NET Standard 2.0 to be recognised as a target framework. So you would need to use MonoDevelop 7.1 for this to work. Also your project would need to target .NET 4.6.1 to be able to install the NuGet package.
Alternatively you could try installing the older version Microsoft.Extensions.Logging 1.1.2 which contains .NET Standard 1.1 assemblies which should be recognised by MonoDevelop 6.1.

Can't install Microsoft.ProjectOxford.Face NuGet into Xamarin Studio iOS project

I tried a lot, but I can't install Microsoft.ProjectOxford.Face NuGet into Xamarin Studio iOS project.
I got this error:
Could not install package 'Microsoft.ProjectOxford.Face 1.2.5.1'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.0', 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.
I tried to update all packages, also Xamarin and still same problem. Only this package does not work - other like Newtonsoft.Json, Mircosoft.Net.HTTP and many other was installed correctly. I tried to install first Microsoft.BCL also Microsoft.BCL.Build and it also does not work.
Maybe you have any thoughts what can I do to make it work?
Unfortunately this is a problem with the Microsoft.ProjectOxford.Face 1.2.5.1 NuGet package itself. Whilst it has a portable class library (PCL) folder this does not map to a valid PCL profile:
portable-net45+wp80+win8+wpa81+aspnetcore50
If the aspnetcore50 part of that folder is removed then it would install into Xamarin.iOS. As it is, NuGet will not allow you to install it.
The only thing left you can do is unzip the NuGet package and try directly using the assembly. NuGet will not allow you to install it.
I believe there are plans to update the NuGet package to fix this, but that has not yet happened.

How to add nuget package in Xamarin studio

I am completely new to xamarin studio. I am trying to add a nuget package. using the add packages dialogue appears to be working however I get an error:
Attempting to gather dependency information for package 'SidebarNavigation.1.9.0.3' with respect to project 'helloios', targeting '.NETPortable,Version=v4.0,Profile=Profile344'
Attempting to resolve dependencies for package 'SidebarNavigation.1.9.0.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'SidebarNavigation.1.9.0.3'
Resolved actions to install package 'SidebarNavigation.1.9.0.3'
For adding package 'SidebarNavigation.1.9.0.3' to project 'helloios' that targets 'portable40-net45+sl5+win8+wp8+wpa81'.
Install failed. Rolling back...
Package 'SidebarNavigation.1.9.0.3' does not exist in project 'helloios'
Package 'SidebarNavigation.1.9.0.3' does not exist in folder '/Users/********/Projects/helloios/packages'
Could not install package 'SidebarNavigation 1.9.0.3'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile344', 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.
This is the github page for the package.
https://github.com/jdehlin/Xamarin-Sidebar
I tried to use different PCL profiles to no effect. I'm not sure how to determine which profile should be used.
The package targets only "Xamarin.iOS". You can't reference it in a PCL that targets more than that, since any other platform wouldn't be able to use it.
Either don't use a PCL, or restrict the PCL to "Xamarin.iOS".
Since this seems to be a UI component, you should reference it from your main project instead, and maybe expose some functionality through services to the PCL, if needed.

Nuget - Installing a package which depends on a library with a higher version than my project's reference

I'm trying to install a nuget package that depends on Newtonsoft.Json version 8.0.2. However, my project references a version 4.5.0 and I get a File Not Found exception when I run my tests. Can I get this to work without upgrading my project reference?

Categories