Skip to content

Commit 972c415

Browse files
authored
Two SDK breaking changes (dotnet#41694)
1 parent c8e212a commit 972c415

File tree

5 files changed

+122
-5
lines changed

5 files changed

+122
-5
lines changed

docs/core/compatibility/9.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff
4545
| Title | Type of change | Introduced version |
4646
|-------------------------------------------------------------------------------|-------------------|--------------------|
4747
| [`dotnet workload` commands output change](sdk/9.0/dotnet-workload-output.md) | Behavioral change | Preview 1 |
48+
| [`installer` repo version no longer documented](sdk/9.0/productcommits-versions.md) | Behavioral change | Preview 5 |
4849
| [Terminal logger is default](sdk/9.0/terminal-logger.md) | Behavioral change | Preview 1 |
50+
| [Warning emitted for .NET Standard 1.x](sdk/9.0/netstandard-warning.md) | Source incompatible | Preview 6 |
4951

5052
## Windows Forms
5153

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: "Breaking change: Warning emitted for .NET Standard 1.x targets"
3+
description: Learn about a breaking change in the .NET 9 SDK where the a build warning is produced if your project targets any .NET Standard version below 2.0.
4+
ms.date: 07/09/2024
5+
---
6+
# Warning emitted for .NET Standard 1.x targets
7+
8+
A warning is now emitted when a project that targets `netstandard1.x` is built with the .NET 9+ SDK.
9+
10+
## Previous behavior
11+
12+
Previously, you could build a project that targeted .NET Standard 1.0 - .NET Standard 1.6 without any build warnings.
13+
14+
## New behavior
15+
16+
Starting in .NET 9, if you build a project that targets .NET Standard 1.0 - .NET Standard 1.6, the following warning is emitted:
17+
18+
> warning NETSDK1215: Targeting .NET Standard prior to 2.0 is no longer recommended. See <https://aka.ms/dotnet/dotnet-standard-guidance> for more details.
19+
20+
## Version introduced
21+
22+
.NET 9 Preview 6
23+
24+
## Type of breaking change
25+
26+
This change can affect [source compatibility](../../categories.md#source-compatibility).
27+
28+
## Reason for change
29+
30+
The build warning was introduced to encourage customers to target .NET Standard 2.0 or .NET 6+. If you target .NET Standard 1.x, you're limiting yourself to a subset of .NET Framework 4.5, which is over 10 years old. A lot of innovation has happened since then that you're missing out on. In addition, .NET Standard 1.x is distributed as a granular set of NuGet packages, which creates a large package dependency graph and results in a lot of packages being downloaded when the project is built.
31+
32+
For more information, see [What is the downside of targeting .NET Standard 1.x?](https://github.com/dotnet/designs/blob/main/accepted/2024/net-standard-recommendation.md#what-is-the-downside-of-targeting-net-standard-1x).
33+
34+
## Recommended action
35+
36+
Update your `TargetFramework` property to `netstandard2.0` or `netstandard2.1`.
37+
38+
If you must stay on an older .NET Standard version, you can set `<CheckNotRecommendedTargetFramework>` to `false` in your project file (for example, *.csproj* file) or *Directory.Build.props* file to skip the target framework version check:
39+
40+
```xml
41+
<PropertyGroup>
42+
...
43+
<CheckNotRecommendedTargetFramework>false</CheckNotRecommendedTargetFramework>
44+
</PropertyGroup>
45+
```
46+
47+
Alternatively, you can suppress the warning using the `<NoWarn>` property in your project file:
48+
49+
```xml
50+
<PropertyGroup>
51+
...
52+
<!-- Disable "Targeting .NET Standard prior to 2.0 is no longer recommended." warning -->
53+
<NoWarn>$(NoWarn);NETSDK1215</NoWarn>
54+
</PropertyGroup>
55+
```
56+
57+
## Affected APIs
58+
59+
N/A
60+
61+
## See also
62+
63+
- [.NET Standard Targeting Recommendations](https://github.com/dotnet/designs/blob/main/accepted/2024/net-standard-recommendation.md)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "Breaking change: `installer` repo version no longer included in `productcommits` files"
3+
description: Learn about a breaking change in the .NET 9 SDK where the `installer` repo commit and version are no longer included in the `productcommits` files.
4+
ms.date: 07/09/2024
5+
---
6+
# `installer` repo version no longer included in `productcommits` files
7+
8+
The version and commit of a subset of the repos that comprise .NET are available in the *productcommits-rid.txt* and *.json* files. These files can be queried from aka.ms links, for example, <https://aka.ms/dotnet/9.0.1xx/daily/productCommit-win-x64.txt>. The files enable customers to get the version and commit of the `runtime`, `aspnetcore`, `windowsdesktop`, and `sdk` repos included in a given build. Some customers have built tooling around this file to help others update their repos to new versions of .NET as builds are available.
9+
10+
In .NET 9, the `dotnet/installer` repo has been merged into the `dotnet/sdk` repo and builds are now shipped exclusively out of the `dotnet/sdk` repo.
11+
12+
## Previous behavior
13+
14+
Previously, the *productcommits-rid.txt* file included the `installer` repo version.
15+
16+
## New behavior
17+
18+
Starting in .NET 9, the `installer` line has been removed from the *productcommits-rid.txt* file.
19+
20+
## Version introduced
21+
22+
.NET 9 Preview 5
23+
24+
## Type of breaking change
25+
26+
This change is a [behavioral change](../../categories.md#behavioral-change).
27+
28+
## Reason for change
29+
30+
The `installer` repo was removed to reduce code-flow time and complexity of builds, and to allow the team to build a full SDK out of the `sdk` repo for testing.
31+
32+
## Recommended action
33+
34+
Any tooling that depends on the `productcommit` file should be updated to use the `sdk` version.
35+
36+
## Affected APIs
37+
38+
N/A

docs/core/compatibility/toc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ items:
3838
items:
3939
- name: "'dotnet workload' commands output change"
4040
href: sdk/9.0/dotnet-workload-output.md
41+
- name: "'installer' repo version no longer documented"
42+
href: sdk/9.0/productcommits-versions.md
4143
- name: Terminal logger is default
4244
href: sdk/9.0/terminal-logger.md
45+
- name: Warning emitted for .NET Standard 1.x targets
46+
href: sdk/9.0/netstandard-warning.md
4347
- name: Windows Forms
4448
items:
4549
- name: BindingSource.SortDescriptions doesn't return null
@@ -1626,8 +1630,12 @@ items:
16261630
items:
16271631
- name: "'dotnet workload' commands output change"
16281632
href: sdk/9.0/dotnet-workload-output.md
1633+
- name: "'installer' repo version no longer documented"
1634+
href: sdk/9.0/productcommits-versions.md
16291635
- name: Terminal logger is default
16301636
href: sdk/9.0/terminal-logger.md
1637+
- name: Warning emitted for .NET Standard 1.x targets
1638+
href: sdk/9.0/netstandard-warning.md
16311639
- name: .NET 8
16321640
items:
16331641
- name: CLI console output uses UTF-8

docs/standard/net-standard.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: .NET Standard
33
description: Learn about .NET Standard, its versions, and the .NET implementations that support it.
4-
ms.date: 11/15/2023
4+
ms.date: 07/09/2024
55
ms.service: dotnet
66
ms.subservice: standard-library
77
ms.custom: "updateeachrelease"
@@ -20,7 +20,10 @@ For information about choosing between .NET 5+ and .NET Standard, see [.NET 5+ a
2020

2121
If you're targeting .NET Standard, we recommend you target .NET Standard 2.0, unless you need to support an earlier version. Most general-purpose libraries should not need APIs outside of .NET Standard 2.0, and .NET Framework doesn't support .NET Standard 2.1. .NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target.
2222

23-
If you need to support .NET Standard 1.x, we recommend that you *also* target .NET Standard 2.0. .NET Standard 1.x is distributed as a granular set of NuGet packages, which creates a large package dependency graph and results in developers downloading a lot of packages when building. For more information, see [Cross-platform targeting](library-guidance/cross-platform-targeting.md) and [.NET 5+ and .NET Standard](#net-5-and-net-standard) later in this article.
23+
If you need to support .NET Standard 1.x, we recommend that you *also* target .NET Standard 2.0. .NET Standard 1.x is distributed as a granular set of NuGet packages, which creates a large package dependency graph and results in a lot of packages being downloaded when the project is built. For more information, see [Cross-platform targeting](library-guidance/cross-platform-targeting.md) and [.NET 5+ and .NET Standard](#net-5-and-net-standard) later in this article.
24+
25+
> [!NOTE]
26+
> Starting in .NET 9, a build warning is emitted if your project targets .NET Standard 1.x. For more information, see [Warning emitted for .NET Standard 1.x targets](../core/compatibility/sdk/9.0/netstandard-warning.md).
2427
2528
### .NET Standard versioning rules
2629

@@ -85,7 +88,7 @@ If you only need to consume .NET Standard 2.0 libraries in your projects, you ca
8588

8689
## .NET 5+ and .NET Standard
8790

88-
.NET 5, .NET 6, .NET 7, and .NET 8 are single products with a uniform set of capabilities and APIs that can be used for Windows desktop apps and cross-platform console apps, cloud services, and websites. The .NET 8 [TFMs](frameworks.md), for example, reflect this broad range of scenarios:
91+
.NET 5, .NET 6, .NET 7, .NET 8, and .NET 9 are single products with a uniform set of capabilities and APIs that can be used for Windows desktop apps and cross-platform console apps, cloud services, and websites. The .NET 8 [TFMs](frameworks.md), for example, reflect this broad range of scenarios:
8992

9093
- `net8.0`
9194

@@ -95,9 +98,12 @@ If you only need to consume .NET Standard 2.0 libraries in your projects, you ca
9598

9699
This is an example of an [OS-specific TFM](frameworks.md#net-5-os-specific-tfms) that add OS-specific functionality to everything that `net8.0` refers to.
97100

98-
### When to target net8.0 vs. netstandard
101+
### When to target `net8.0` vs. `netstandard`
102+
103+
For existing code that targets .NET Standard 2.0 or later, there's no need to change the TFM to `net8.0` or a later TFM. .NET 8 implements .NET Standard 2.1 and earlier. The only reason to retarget from .NET Standard to .NET 8+ would be to gain access to more runtime features, language features, or APIs. For example, to use C# 9, you need to target .NET 5 or a later version. You can multitarget .NET 8 and .NET Standard to get access to newer features and still have your library available to other .NET implementations.
99104

100-
For existing code that targets `netstandard`, there's no need to change the TFM to `net8.0` or a later TFM. .NET 8 implements .NET Standard 2.1 and earlier. The only reason to retarget from .NET Standard to .NET 8+ would be to gain access to more runtime features, language features, or APIs. For example, in order to use C# 9, you need to target .NET 5 or a later version. You can multitarget .NET 8 and .NET Standard to get access to newer features and still have your library available to other .NET implementations.
105+
> [!NOTE]
106+
> If your project targets .NET Standard 1.x, we recommend you retarget it to .NET Standard 2.0 or .NET 6+. For more information, see [Warning emitted for .NET Standard 1.x targets](../core/compatibility/sdk/9.0/netstandard-warning.md).
101107
102108
Here are some guidelines for new code for .NET 5+:
103109

0 commit comments

Comments
 (0)