Update Portable Class Library project to .NET Standard23 Feb 2019
Recently, I decided to upgrade my TitiusLabs.Xamarin library to the latest version of Xamarin.Forms and to .NET Standard 2.0. Here a small guide you need to follow if you want to upgrade your project from a very old version.
Update your project to .NET Standard 2.0
The first step in my path is the update of the TitiusLabs.Core project, a Portable Class Library (PCL) project, to a .NET Standard Library. To proceed, you need to be sure to have the right .NET Core version installed so, if not, go to the download page and install it!
Now, simply open the
.csproj file and full replace it with the following xml:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup> <ItemGroup> <Folder Include="Properties\" /> </ItemGroup> </Project>
Check your solution
Reopen your solution, or refresh it, and check if all projects correcly loads and reference your .NET Standard project. Most probably, you’ll get the following errors:
If you want to still use
AssemblyInfo.cs, then add the following xml element into the
<PropertyGroup> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> </PropertyGroup>
Now your code will work fine. To choose the correct version, be sure to check .NET Standard compatibility on this page.