android: [net6-android] A package with netstandard2.0, monoandroid10.0 and net6.0-android should not favor monoandroid10.0
Steps to Reproduce
- Download the following solution: net6androidnuget-2.zip
- In the
HelloAndroidfolder, rundotnet build
Expected Behavior
The build passes as Class1 is defined only in net6.0-android30.0 in the ClassLibrary15 package.
Actual Behavior
The build fails where Class1 is not defined, because monoandroid10.0 is favored over net6.0-android30.0 even if the app is using net6.0-android. Note that the issue does not happen if netstandard2.0 is not included in the package.
Version Information
6.0.100-preview.4.21215.1
Additional info
This issue is similar to https://github.com/xamarin/xamarin-android/issues/5857, but with the monoandroid10.0 target framework added to the list.
This issue also looks similar to https://github.com/xamarin/xamarin-android/issues/5819, but in the context of package references, not projects references.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 16 (8 by maintainers)
Commits related to this issue
- [One .NET] remove NuGet workarounds Fixes: https://github.com/xamarin/xamarin-android/issues/5896 Since early in .NET 5 development, we had workarounds (hacks?) for enabling the legacy Xamarin.Forms... — committed to jonathanpeppers/xamarin-android by jonathanpeppers 5 years ago
- [One .NET] remove NuGet workarounds Fixes: https://github.com/xamarin/xamarin-android/issues/5896 Since early in .NET 5 development, we had workarounds (hacks?) for enabling the legacy Xamarin.Forms... — committed to jonathanpeppers/xamarin-android by jonathanpeppers 5 years ago
- [One .NET] remove NuGet workarounds (#5973) Fixes: https://github.com/xamarin/xamarin-android/issues/5896 Since early in .NET 5 development, we had workarounds (hacks?) for enabling the legacy Xa... — committed to dotnet/android by jonathanpeppers 5 years ago
- [One .NET] remove NuGet workarounds (#5973) Fixes: https://github.com/xamarin/xamarin-android/issues/5896 Since early in .NET 5 development, we had workarounds (hacks?) for enabling the legacy Xa... — committed to dotnet/android by jonathanpeppers 5 years ago
My plan right now for this is:
Microsoft.Android.Sdk.NuGet.targetsfile completely:https://github.com/xamarin/xamarin-android/blob/c60635bf2161f6e3b2d74ebcd7a3f96deef956a2/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NuGet.targets#L23-L35
In the mean time, if you need this to work, you might try editing
Microsoft.Android.Sdk.NuGet.targetslocally and see if some combination works. I wonder if listingnet6.0-androidin$(PackageTargetFallback)with no 30.0 would help. If you figure something out, let me know.What we have now is basically several hacks that enable legacy Xamarin.Forms packages to work in .NET 6, but itโs definitely not correct yet.