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

Add special case for Xamarin assets to nuget precedence rules #222

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions accepted/2021/net6.0-tfms/net6.0-tfms.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ follows:
- However, it should still prefer `net6.0` assets over `xamarin.ios`.
- It also shouldn't be compatible with any other existing Xamarin TFM (such
as `xamarin.mac`)
* It should prefer `netstandard2.1` and earlier assets before `net5.0`
- Packages with `net5.0`, `netcoreapp3.1` and earlier assets assumed desktop-like environments,
since this was the only place where .NET Core existed. This causes issues on mobile.
* Generate NuGet warning [NU1701] when a `xamarin.ios` asset is being used
- Package 'packageId' was restored using 'xamarin.ios' instead the project
target framework 'net6.0-maccatalyst'. This package may not be fully
Expand All @@ -114,56 +117,63 @@ not generate a warning. `net6.0-android` will behave in the same way as `net6.0-
except that the Xamarin.Android TFM is `monoandroid` (1.0 - 12.0). `net6.0-tizen` is
also the same as `net6.0-ios` except the TFM is `tizen`.

A special case are packages which have a Xamarin TFM asset that points to `_._` which normally
means that the asset should be picked from the framework/GAC instead of the package.
However we have cases like `System.ComponentModel.Composition` where in "legacy" Xamarin this
assembly shipped as part of the framework (hence e.g. `xamarin.ios` in the package points to `_._`)
but in .NET Core the assembly is _not_ in the shared framework. We need to skip picking the
Xamarin TFM asset in this case to avoid a build break due to missing references.

This reasoning results in these precedence rules:

**net6.0-ios**

1. `net6.0-ios`
1. `net6.0`
1. `xamarin.ios` (no warning)
1. `xamarin.ios` (no warning, skip if it points to `_._`)
1. `netstandard2.1` – `1.0`
1. `net5.0`
1. `netcoreapp3.1` – `1.0`
1. `netstandard2.1` – `1.0`
1. `net4.x` – `1.0` (warning)

**net6.0-maccatalyst**

1. `net6.0-maccatalyst`
1. `net6.0`
1. `xamarin.ios` ([NU1701] warning)
1. `xamarin.ios` ([NU1701] warning, skip if it points to `_._`)
1. `netstandard2.1` – `1.0`
1. `net5.0`
1. `netcoreapp3.1` – `1.0`
1. `netstandard2.1` – `1.0`
1. `net4.x` – `1.0 ([NU1701] warning)

**net6.0-macos**

1. `net6.0-macos`
1. `net6.0`
1. `xamarin.macos` (no warning)
1. `xamarin.macos` (no warning, skip if it points to `_._`)
1. `netstandard2.1` – `1.0`
1. `net5.0`
1. `netcoreapp3.1` – `1.0`
1. `netstandard2.1` – `1.0`
1. `net4.x` – `1.0` ([NU1701] warning)

**net6.0-tvos**

1. `net6.0-tvos`
1. `net6.0`
1. `xamarin.tvos` (no warning)
1. `xamarin.tvos` (no warning, skip if it points to `_._`)
1. `netstandard2.1` – `1.0`
1. `net5.0`
1. `netcoreapp3.1` – `1.0`
1. `netstandard2.1` – `1.0`
1. `net4.x` – `1.0` ([NU1701] warning)

**net6.0-android**

1. `net6.0-android`
1. `net6.0`
1. `monoandroid12.0` - `1.0` (no warning)
1. `monoandroid12.0` - `1.0` (no warning, skip if it points to `_._`)
1. `netstandard2.1` – `1.0`
1. `net5.0`
1. `netcoreapp3.1` – `1.0`
1. `netstandard2.1` – `1.0`
1. `net4.x` – `1.0` ([NU1701] warning)

The currently supported `monoandroid` TFMs are:
Expand Down