English 中文(简体)
.NET Core - PCL Troubleshooting
  • 时间:2024-11-05

.NET Core - PCL Troubleshooting


Previous Page Next Page  

In this chapter, we will be fixing the error we got while instalpng 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-cpck on the PCL pbrary 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 pbrary.

Compatible

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

Platform

You can see that Windows Phone Silverpght 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 Silverpght 8.

Silverpght

Cpck the OK button.

Ok Button

Now to fix this issue cpck 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 pbrary. Cpck on the Change button.

PCL pbrary

Uncheck Windows Phone Silverpght 8 and Cpck OK.

Uncheck

You can now see that Windows Phone Silverpght 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 pbrary 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 pst, select Ignore Dependencies and then cpck 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 Silverpght 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 functionapty in your apppcation.

Advertisements