.NET Core - PCL Troubleshooting



In this chapter, we will be fixing the error we got while installing the NuGet package from our private feed in Xamarin.Forms project.

Fixing error

We will further understand the problem in brief. To start with, let us right-click on the PCL library and select Properties.

On this page, you will see the whole series of frameworks targeted. From the error, you can see that the .NETPortable profile 259 is not compatible with our StringLibrary 1.0.1. However, it is trying to take reference from the .NET Standard 1.1 library.

Compatible

Let us now see the .NET Standard Library and identify which platform is not compatible with our library.

Platform

You can see that Windows Phone Silverlight 8 is compatible with .NET Standard 1.0. If you open the following webpage, then you will see that Profile259 can support only .NET Standard 1.0.

Profile259

Let us now uncheck Windows Phone Silverlight 8.

Silverlight

Click the OK button.

Ok Button

Now to fix this issue click OK and cancel the Change Targets dialog and then open Package Manager Console and execute the following command.

PM > Uninstall-Package Xamarin.Forms

Execute Command

Let us now go to the Properties of PCL library. Click on the Change button.

PCL library

Uncheck Windows Phone Silverlight 8 and Click OK.

Uncheck

You can now see that Windows Phone Silverlight 8 is no longer available in Targeted framework. You can also see the profile that is the target now. To see this, let us unload the PCL library and edit the XamarinApp.csproj file.

Unload

You can see now that TargetFrameworkProfile is now Profile111.

TargetFrameworkProfile

If you open the documentation, then you will see that Profile111 is supporting .NET Standard 1.1.

Documentation

Let us now reload the PCL again and open the NuGet Package Manager and try to install the StringLibrary package from private feed.

Package private feed

From the Dependency behavior dropdown list, select Ignore Dependencies and then click Install.

Dependencies

You can see that the StringLibrary package is now installed from the private feed. If you expand the References of PCL, then you will see that the StringLibrary reference is also added as shown below.

PCL Reference

We had uninstalled the Xamarin.Forms for the Windows Phone Silverlight 8 issue. The Xamarin.Forms needs to be installed again. It is recommended that the same version is installed.

Same Version

Once the installation completes, let us use the StringLibrary functionality in your application.

Advertisements