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

Automatically generate .NETStandard compat errors #57057

Merged
merged 4 commits into from
Aug 10, 2021

Conversation

ViktorHofer
Copy link
Member

Before this change, a project had to explicitly add a
NETStandardCompatError item to declare that a given tfm range
shouldn't be supported when packaging.

Automate this logic so that projects don't need to specify the item
themselves anymore. Instead condition the NETStandardCompatError target
calcuation logic on the existence of both a .NETStandard and a
.NETCoreApp tfm.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Aug 9, 2021

Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Issue Details

Before this change, a project had to explicitly add a
NETStandardCompatError item to declare that a given tfm range
shouldn't be supported when packaging.

Automate this logic so that projects don't need to specify the item
themselves anymore. Instead condition the NETStandardCompatError target
calcuation logic on the existence of both a .NETStandard and a
.NETCoreApp tfm.

Author: ViktorHofer
Assignees: -
Labels:

area-Infrastructure-libraries

Milestone: -

Before this change, a project had to explicitly add a
NETStandardCompatError item to declare that a given tfm range
shouldn't be supported when packaging.

Automate this logic so that projects don't need to specify the item
themselves anymore. Instead condition the NETStandardCompatError target
calcuation logic on the existence of both a .NETStandard and a
.NETCoreApp tfm.
@ViktorHofer ViktorHofer force-pushed the NetStandardCompatErrorAutomation branch from 77fb8ab to 32d6988 Compare August 9, 2021 08:07
.NETCoreApp. This prohibits users to consume packages on an older .NETCorAapp version
than the minimum supported one. -->
<ItemGroup Condition="'$(DisableNETStandardCompatErrorForNETCoreApp)' != 'true'">
<NETStandardCompatError Include="netcoreapp2.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would this work after we dead end netcoreapp2.1 or netcoreapp3.1 ? would we have to change it ? can we store it in a property which points to the last netcoreapp framework that went out of support.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

netcoreapp2.1 is already out-of-support and not included in packages. The Include defines the lower boundary for which to throw and the Supported attribute the upper exclusive boundary. In this case an error is thrown for netcoreapp2.0 - netcoreapp3.0. On netcoreapp3.1 (= the $(NetCoreAppMinimum)) no exception is thrown.

Example of the System.Drawing.Common nuget package:

image

This means that as long as the $(NetCoreAppMinimum) property marks the minimum supported version, this logic doesn't need to be updated. For NET7 we might want to add another item for NETFramework as net461 will be out of support by when NET7 ships.

Copy link
Contributor

@Anipik Anipik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one comment, other than that looks good.

eng/packaging.targets Outdated Show resolved Hide resolved
Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
@ViktorHofer ViktorHofer merged commit 4d82932 into dotnet:main Aug 10, 2021
@ViktorHofer ViktorHofer deleted the NetStandardCompatErrorAutomation branch August 10, 2021 05:19
@ghost ghost locked as resolved and limited conversation to collaborators Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants