Search code examples
visual-studioxamarinxamarin.androidxamarin.iosvisual-studio-mac

Upgrading a Xamarin .net standard 2.0 solution to .net core or .net 5 options / path?


We have a .net standard 2.0 Xamarin solution with iOS and Android projects.

On a slightly unrelated note, I've been trying unsuccessfully to fix some warnings, which recommends upgrading .net core.

However, I'm not sure .net core is the right option or if there something better like .net 5. I'm not even sure if .net standard 2.0 is that old.

We use macs and can't use the .NET Portability Analyzer.

I've also tried try-convert which gives me the following...

Xamarin.Forms.props
Xamarin.Build.Download.props
Xamarin.iOS.CSharp.targets
Microsoft.Bcl.Build.targets
NETStandard.Library.targets
Xamarin.Firebase.iOS.Core.targets
Xamarin.Firebase.iOS.Analytics.targets
Xamarin.Build.Download.targets
Xamarin.Forms.targets
SkiaSharp.targets
HarfBuzzSharp.targets

I've also seen this from 2017, where I've tried to simply change the TargetFramework just to see what happens, but get several errors like Project targets 'netcoreapp3.1'. It cannot be referenced by a project that targets 'Xamarin.iOS,Version=v1.0'

Tbh I don't know where to start and what our options are.

None of the upgrade guides that I've seen are up-to-date or relevant to Xamarin or possible on the mac with Visual Studio for Mac.

It seems like a real minefield on the mac, with limited tools.

Edit: If I try and create a new Xamarin solution, it doesn't use .net core, still use .net standard 2.0, I think describes Microsofts intension.


Solution

  • Stick with .NET Standard 2.0 until .NET 6.0 is out. As announced in the .NET 5.0 announcment blog post here: https://devblogs.microsoft.com/dotnet/announcing-net-5-0/

    We’ve also done much of the early work in 5.0 so that Xamarin developers can use the unified .NET platform when we release .NET 6.0.

    Hence, .NET 5.0 is not a viable upgrade path for projects targeting Xamarin specific targets.