.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.
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.
Let us now see the .NET Standard Library and identify which platform is not compatible with our library.
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.
Let us now uncheck Windows Phone Silverlight 8.
Click the 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
Let us now go to the Properties of PCL library. Click on the Change button.
Uncheck Windows Phone Silverlight 8 and Click OK.
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.
You can see now that TargetFrameworkProfile is now Profile111.
If you open the documentation, then you will see that Profile111 is supporting .NET Standard 1.1.
Let us now reload the PCL again and open the NuGet Package Manager and try to install the StringLibrary package from private feed.
From the Dependency behavior dropdown list, select Ignore Dependencies and then click Install.
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.
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.
Once the installation completes, let us use the StringLibrary functionality in your application.