Xamarin.Android9.0 target should be chosen over netstandard2.0 target by Android test project · Issue #236 · novotnyllc/MSBuildSdkExtras · GitHub
Skip to content

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

Open

Description

@AArnott

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?

Activity

  1. AArnott commented on Aug 15, 2020

    @AArnott
    CollaboratorAuthor

    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'.

  2. AArnott commented on Aug 15, 2020

    @AArnott
    CollaboratorAuthor

    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?

  3. AArnott commented on Aug 15, 2020

    @AArnott
    CollaboratorAuthor

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

  4. clairernovotny commented on Aug 16, 2020

    @clairernovotny
    Collaborator

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

  5. AArnott commented on Aug 16, 2020

    @AArnott
    CollaboratorAuthor

    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?

  6. clairernovotny commented on Aug 16, 2020

    @clairernovotny
    Collaborator
  7. AArnott commented on Aug 16, 2020

    @AArnott
    CollaboratorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions