Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Context: https://github.com/dotnet/designs/blob/38bffe6c03a149c80f1c3b22787f33c794e71c76/accepted/2021/net6.0-tfms/net6.0-tfms.md

We don't have a complete implementation for .NET 6 & NuGet yet, so for
for things to work at all we have Microsoft.Android.Sdk.NuGet.targets
that contains workarounds that enable:

  • Given some NuGet package, Foo.nupkg
  • Try lib/net6.0-android/Foo.dll
  • Try lib/monoandroid10.0/Foo.dll, other $(TFV) etc.

We can now test the above scenario with AndroidX NuGet packages:

Unfortunately, consuming Xamarin.AndroidX.AppCompat results in our
build using lib/monoandroid90/Xamarin.AndroidX.AppCompat.dll over
the .NET 6 one!

I was able to reproduce this failure in the XASdkTests.DotNetBuild()
test, as any Release build will fail during linking when using
MonoAndroid assemblies without KnownPackages.AddDotNetCompatPackages().

To solve the problem, we need to list net6.0-android30.0 in
$(PackageTargetFallback). Now .NET 6 packages are preferred over
MonoAndroid ones. Lastly I added MonoAndroid11.0, because it was
missing.

Eventually I hope to delete Microsoft.Android.Sdk.NuGet.targets
completely when the NuGet implementation of TFMs in .NET 6 is
complete.

Context: https://github.com/dotnet/designs/blob/38bffe6c03a149c80f1c3b22787f33c794e71c76/accepted/2021/net6.0-tfms/net6.0-tfms.md

We don't have a complete implementation for .NET 6 & NuGet yet, so for
for things to work *at all* we have `Microsoft.Android.Sdk.NuGet.targets`
that contains workarounds that enable:

* Given some NuGet package, `Foo.nupkg`
* Try `lib/net6.0-android/Foo.dll`
* Try `lib/monoandroid10.0/Foo.dll`, other `$(TFV)` etc.

We can now test the above scenario with AndroidX NuGet packages:

* dotnet/android-libraries#247
* https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json
* `<PackageReference Include="Xamarin.AndroidX.AppCompat" Version = "1.2.0.7-net6preview01" />`

Unfortunately, consuming `Xamarin.AndroidX.AppCompat` results in our
build using `lib/monoandroid90/Xamarin.AndroidX.AppCompat.dll` over
the .NET 6 one!

I was able to reproduce this failure in the `XASdkTests.DotNetBuild()`
test, as any `Release` build will fail during linking when using
`MonoAndroid` assemblies without `KnownPackages.AddDotNetCompatPackages()`.

To solve the problem, we need to list `net6.0-android30.0` in
`$(PackageTargetFallback)`. Now .NET 6 packages are preferred over
`MonoAndroid` ones. Lastly I added `MonoAndroid11.0`, because it was
missing.

Eventually I hope to delete `Microsoft.Android.Sdk.NuGet.targets`
completely when the NuGet implementation of TFMs in .NET 6 is
complete.
@jonathanpeppers
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers merged commit 2f83bdd into dotnet:master Feb 24, 2021
@jonathanpeppers jonathanpeppers deleted the dotnet-packagetargetfallback branch February 24, 2021 14:56
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants