Skip to content

Commit a7880a6

Browse files
authored
Add breaking change for RID warning (#26203)
1 parent d708831 commit a7880a6

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

docs/core/compatibility/6.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff
100100
| [Implicit global using directives in C# projects](sdk/6.0/implicit-namespaces.md) | Preview 7 |
101101
| [Implicit global using directives disabled](sdk/6.0/implicit-namespaces-rc1.md) | RC 1|
102102
| [OutputType not automatically set to WinExe](sdk/6.0/outputtype-not-set-automatically.md) | RC 1 |
103+
| [RuntimeIdentifier warning if self-contained is unspecified](sdk/6.0/runtimeidentifier-self-contained.md) | RC 1 |
103104

104105
## Serialization
105106

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "Breaking change: `RuntimeIdentifier` warning if self-contained is unspecified"
3+
description: Learn about the breaking change in .NET 6 where specifying a `RuntimeIdentifier` without specifying whether an app is self-contained results in a warning.
4+
ms.date: 09/20/2021
5+
---
6+
# RuntimeIdentifier warning if self-contained is unspecified
7+
8+
If you specify a `RuntimeIdentifier` in your project file or use the `-r` option with `dotnet`, the .NET SDK defaults the build, publish, and run outputs to be self-contained applications. The default without specifying a `RuntimeIdentifier` is to have a framework-dependent application. This change introduces a new warning (NETSDK1179) if you specify a `RuntimeIdentifier` without specifying whether the application is self-contained.
9+
10+
## Version introduced
11+
12+
.NET 6 RC 1
13+
14+
## Previous behavior
15+
16+
In previous versions, specifying a `RuntimeIdentifier` would silently change the application from a framework-dependent application to a self-contained application.
17+
18+
## New behavior
19+
20+
In .NET 6, if you specify a `RuntimeIdentifier` without specifying whether the application is self-contained, you'll get the following warning:
21+
22+
**warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used.**
23+
24+
For example, the following command will generate the warning:
25+
26+
```dotnetcli
27+
dotnet publish -r win-x86
28+
```
29+
30+
## Change category
31+
32+
This change may affect [*source compatibility*](../../categories.md#source-compatibility).
33+
34+
## Reason for change
35+
36+
The default without specifying a `RuntimeIdentifier` is to generate a framework-dependent application. This default caused confusion for many customers. The purpose of adding the warning is to:
37+
38+
- Warn customers of the behavior change to default to a framework-dependent app.
39+
- Encourage customers to specifically choose the type of application they want to build.
40+
- Prepare customers for possibly changing the behavior in .NET 7 to default to framework-dependent.
41+
42+
## Recommended action
43+
44+
- Specify a boolean value in your project file for `SelfContained`.
45+
- Or, add `--sc` with a value to your build or publish command.
46+
47+
## Affected APIs
48+
49+
N/A

docs/core/compatibility/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ items:
137137
href: sdk/6.0/implicit-namespaces-rc1.md
138138
- name: OutputType not automatically set to WinExe
139139
href: sdk/6.0/outputtype-not-set-automatically.md
140+
- name: RuntimeIdentifier warning if self-contained is unspecified
141+
href: sdk/6.0/runtimeidentifier-self-contained.md
140142
- name: Windows Forms
141143
items:
142144
- name: APIs throw ArgumentNullException
@@ -765,6 +767,8 @@ items:
765767
href: sdk/6.0/implicit-namespaces-rc1.md
766768
- name: OutputType not automatically set to WinExe
767769
href: sdk/6.0/outputtype-not-set-automatically.md
770+
- name: RuntimeIdentifier warning if self-contained is unspecified
771+
href: sdk/6.0/runtimeidentifier-self-contained.md
768772
- name: .NET 5
769773
items:
770774
- name: Directory.Packages.props files imported by default

0 commit comments

Comments
 (0)