Convert Xamarin PCL Template to use NET Standard
July 18, 2017
Following this tutorial: https://oren.codes/2017/04/23/using-xamarin-forms-with-net-standard-vs-2017-edition/
-
Create a PCL Cross Platform Forms app
-
Remove the Xamarin.Forms nuget package from the platform-specific csproj.
-
In Nuget Package Manager settings, select "Allow format selection of first package install"
-
In the platform-specific csproj, add back the Xamarin.Forms Nuget package. Select "Package Reference" as the format.
- Xamarin.Forms should now be listed in the References list under your project, with the Nuget icon.
-
Replace the csproj of the PCL with this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<!-- https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets#packagetargetfallback Allows getting nuget packages that don't explicitly set netstandard version -->
<PackageTargetFallback>portable-net45</PackageTargetFallback>
<DebugType>full</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
<EmbeddedResource Include="**\*.xaml" SubType="Designer" Generator="MSBuild:UpdateDesignTimeXaml" />
</ItemGroup>
</Project>
- Delete AssemblyInfo from the PCL (now .NET Standard) project. These properties are generated by Visual Studio now and it will result in duplicates if you don't.