dotnet/roslyn-sdk

[Bug]: using `Net60Android` with another package that support net6.0-android doesn't work properly

Youssef1313 opened this issue · 1 comments

Using ReferenceAssemblies.Net.Net60Android.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.UI", "4.8.24"))), I expect that resolved references from Uno.UI will be those that come from net6.0-android folder in the package.

However, I see the following in compilation.ExternalReferences:

image

The resolved dll of the NuGet package is netstandard

Here is the package contents:

image

My guess about the issue:

private static readonly Lazy<ReferenceAssemblies> _lazyNet60Android =
new Lazy<ReferenceAssemblies>(() =>
Net60.AddPackages(
ImmutableArray.Create(
new PackageIdentity("Microsoft.Android.Ref", "31.0.100-rc.1.12"))));

Here we use Net60.AddPackages, but the TargetFramework of Net60 is net6.0 rather than net6.0-android, so NuGet decided to use netstandard2.0 as the most nearest/compatible TFM for net6.0.

This is unexpected when using Net60Android.