Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin.Android9.0 target should be chosen over netstandard2.0 target by Android test project #236

Open
AArnott opened this issue Aug 15, 2020 · 7 comments

Comments

@AArnott
Copy link
Collaborator

AArnott commented Aug 15, 2020

When I have a multi-targeting library that offers netstandard2.0 and Xamarin.Android9.0 targets, and I reference that from a Xunit Devices Android project, I expect the Xamarin.Android9.0 target to be used by the android app since it's platform specific, which should be preferred, I think.

But in the attached minimal repro we see the test fails because the netstandard2.0 build of the library is selected.

XamarinTest.zip

Am I misunderstanding something? How can I get the library's android target to be used in android projects that reference it?

@AArnott
Copy link
Collaborator Author

AArnott commented Aug 15, 2020

I also notice that packing the multi-targeting library fails with:

1>C:\Program Files\dotnet\sdk\3.1.302\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(198,5): error NU5027: Invalid target framework for the file 'C:\Users\andarno\source\repos\XamarinTest\XamarinTest\bin\Debug\xamarin.android9.0\XamarinTest.dll'.

@AArnott
Copy link
Collaborator Author

AArnott commented Aug 15, 2020

Switching the TFM from Xamarin.Android9.0 to MonoAndroid9 solves both problems. If that's the supported way, why is Xamarin.Android listed in the README instead of monoandroid?

@AArnott
Copy link
Collaborator Author

AArnott commented Aug 15, 2020

I have the same problem with iOS. Xamarin.iOS didn't get picked up by the iOS project. But xamarinios did (no period).

@clairernovotny
Copy link
Collaborator

This seems like a NuGet bug. The extras has nothing to do with TFM selection.

@AArnott
Copy link
Collaborator Author

AArnott commented Aug 16, 2020

I wonder. The documented list of TFMs (if you scroll down far enough) include a table that lists monoandroid and xamarinios. It does not list the two that your README lists. So NuGet is acting consistently with the MS published docs as far as I can tell. Which begs the question: where did you get the Xamarin.iOS and Xamarin.Android TFMs that you're using?

@clairernovotny
Copy link
Collaborator

Xamarin.iOS comes from https://docs.microsoft.com/en-us/xamarin/cross-platform/app-fundamentals/nuget-manual#nuget-package-xamarin-profiles

I don't remember where I saw Xamarin.Android.

@AArnott
Copy link
Collaborator Author

AArnott commented Aug 16, 2020

What do you think about updating your README to reflect what currently works today, and we can pursue filing bugs against nuget to either honor the doc you linked to, or to correct the doc to reflect today's behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants