How can I upgrade Xamarin Forms UWP (older format: shared code in .shproj not .csproj) to C# version 8.0 or higher?

Viewed 88

I have a Xamarin forms project with Uwp, and I'd like to know how to upgrade the C# version from 7.3 to 8.0+.

I followed these links:

How to use the latest C# version in Xamarin Forms projects

https://montemagno.com/use-csharp-8-everywehre/

which suggest adding the following to my csproj file:

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
    <LangVersion>8.0</LangVersion>
  </PropertyGroup>

or

  <PropertyGroup>
    <LangVersion>8.0</LangVersion>
  </PropertyGroup>

I get the following: Android: I get v8.0+ out of the box with no mod to csproj iOS: Adding the LangVersion as above to csproj successfully upgrades the version to later than 7.3 UWP: Adding the LangVersion has no effect.

How can I upgrade C# for UWP?

UPDATE

After adding:

<TargetFramework>netstandard2.0</TargetFramework>

OR

<TargetFramework>netstandard2.1</TargetFramework>

all my references get broken:

enter image description here

0 Answers
Related