Commit 2f83bdd
authored
[One .NET] update $(PackageTargetFallback) for NuGet packages (#5654)
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.1 parent d28ba53 commit 2f83bdd
File tree
2 files changed
+9
-0
lines changed- src/Xamarin.Android.Build.Tasks
- Microsoft.Android.Sdk/targets
- Tests/Xamarin.Android.Build.Tests
2 files changed
+9
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
358 | 364 | | |
359 | 365 | | |
360 | 366 | | |
| |||
364 | 370 | | |
365 | 371 | | |
366 | 372 | | |
| 373 | + | |
367 | 374 | | |
368 | 375 | | |
369 | 376 | | |
| |||
0 commit comments