docs icon indicating copy to clipboard operation
docs copied to clipboard

[Breaking change]: .NET SDK will warn customers when targeting .NET standard version <2.0

Open marcpopMSFT opened this issue 1 year ago • 1 comments

Description

.NET standard versions 1.0 through 1.6 include the implementation assemblies. This is bad as it will pull those references into deps.json and other dependency locations and could get flagged by scanners. While customers can still target those versions if they want, we recommend they upgrade to 2.0 or 2.1.

More information is available at https://aka.ms/dotnet/dotnet-standard-guidance

Version

.NET 9 Preview 6

Previous behavior

Customers could target .NET Standard 1.0 through 1.6 without issue.

New behavior

warning NETSDK1215: Targeting .NET Standard prior to 2.0 is no longer recommended. See https://aka.ms/dotnet/dotnet-standard-guidance for more details.

Type of breaking change

  • [ ] Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • [ ] Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • [X] Behavioral change: Existing binaries may behave differently at run time.

Reason for change

https://github.com/dotnet/designs/blob/main/accepted/2024/net-standard-recommendation.md

Recommended action

Update your TargetFramework property to netstandard2.0 or netstandard2.1. If required to stay on an older .NET Standard, you can set <CheckNotRecommendedTargetFramework>false</CheckNotRecommendedTargetFramework> in your project or Directory.Build.props

Feature area

SDK

Affected APIs

No response

marcpopMSFT avatar Jun 25 '24 21:06 marcpopMSFT

CC @terrajobst for visibility

marcpopMSFT avatar Jun 25 '24 21:06 marcpopMSFT

@marcpopMSFT Wouldn't this be a "source incompatible" change?

gewarren avatar Jul 09 '24 21:07 gewarren

@marcpopMSFT Wouldn't this be a "source incompatible" change?

If you have warnings as errors, yes. So you may be right that we should include that as well since many customers do have that configured.

marcpopMSFT avatar Jul 09 '24 23:07 marcpopMSFT