[One .NET] update $(PackageTargetFallback) for NuGet packages #5654
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.targetsthat contains workarounds that enable:
Foo.nupkglib/net6.0-android/Foo.dlllib/monoandroid10.0/Foo.dll, other$(TFV)etc.We can now test the above scenario with AndroidX NuGet packages:
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version = "1.2.0.7-net6preview01" />Unfortunately, consuming
Xamarin.AndroidX.AppCompatresults in ourbuild using
lib/monoandroid90/Xamarin.AndroidX.AppCompat.dlloverthe .NET 6 one!
I was able to reproduce this failure in the
XASdkTests.DotNetBuild()test, as any
Releasebuild will fail during linking when usingMonoAndroidassemblies withoutKnownPackages.AddDotNetCompatPackages().To solve the problem, we need to list
net6.0-android30.0in$(PackageTargetFallback). Now .NET 6 packages are preferred overMonoAndroidones. Lastly I addedMonoAndroid11.0, because it wasmissing.
Eventually I hope to delete
Microsoft.Android.Sdk.NuGet.targetscompletely when the NuGet implementation of TFMs in .NET 6 is
complete.