2
votes

I have a Xamarin Forms project and the majority of times that I want to install a nuget package I have an error saying that:

Install-Package : Could not install package 'Microcharts 0.7.1-pre'. 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.

I Assume I can work this out by changing the project .net framework target. But when I go and change it, I get an error saying that it cannot change the target because that implies upgrading nuget to 3.0 and It canĀ“t do that.

So my question is: Which is the best way(and simplest) to change the target framework so I have less problems like above with nuget packages.

2

2 Answers

5
votes

This library was built to target .NETStandard v1.4. You are trying to use it in a PCL project, that is not possible. PCL is on the way out as the previous not-so-good way to build cross-platform libraries, .NETStandard is the new way.

There is no older version available of this library, rebuilding it from source is a possible option. But realistically it is time to move on to avoid hitting this wall over and over again, you need to update your tooling so you can consume these kind of libraries. The VS2017 Community edition is freeware.

2
votes

It is time to go from your .NET PCL Library to an appropriate .NET Standard Library.

Here are some links concerning the migration to .NET Standard.

My Suggestion concerning the version of the .NET Standard to use.

If you don't care about backwards compatibility (You want to use the latest OS and SDKs) go all the way to .NET Standard 2.

If you want to have a good backward compatibility you should go on .NET Standard 1.1 - 1.5.

On most projects i use 1.4 - 1.5.