Skip to content

Commit bdae2ee

Browse files
authored
Add default RID breaking change for .NET Framework targets (#43879)
1 parent a8c1705 commit bdae2ee

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

docs/core/compatibility/9.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff
103103
| [`dotnet watch` incompatible with Hot Reload for old frameworks](sdk/9.0/dotnet-watch.md) | Behavioral change | RC 1 |
104104
| [`dotnet workload` commands output change](sdk/9.0/dotnet-workload-output.md) | Behavioral change | Preview 1 |
105105
| [`installer` repo version no longer documented](sdk/9.0/productcommits-versions.md) | Behavioral change | Preview 5 |
106+
| [New default RID used when targeting .NET Framework](sdk/9.0/default-rid.md) | Source incompatible | GA |
106107
| [Terminal logger is default](sdk/9.0/terminal-logger.md) | Behavioral change | Preview 1 |
107108
| [Version requirements for .NET 9 SDK](sdk/9.0/version-requirements.md) | Source incompatible | GA |
108109
| [Warning emitted for .NET Standard 1.x target](sdk/9.0/netstandard-warning.md) | Source incompatible | Preview 6 |
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: "Default RID used when targeting .NET Framework"
3+
description: "Learn about the breaking change in the .NET 9 SDK where a new default RID is used for apps that target .NET Framework."
4+
ms.date: 12/5/2024
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/43692
7+
---
8+
9+
# Default RID used when targeting .NET Framework
10+
11+
In .NET 8, a change was introduced to [use a smaller runtime identifier (RID) graph](../8.0/rid-graph.md) when targeting `net8.0` and later versions.
12+
13+
However, this broke customers who multi-target .NET and .NET Framework. That's because the restore happens once, but the .NET Framework project tries to use the old RID default and the .NET (Core) project tries to use the new reduced RID graph.
14+
15+
To enable this multi-targeting scenario, a default RID that's compatible with the new RID graph is now used in this scenario.
16+
17+
## Version introduced
18+
19+
.NET 9 GA
20+
21+
## Previous behavior
22+
23+
SDK-style projects that targeted .NET Framework with no RID set defaulted to `win7-x86` or `win7-x64`.
24+
25+
## New behavior
26+
27+
SDK-style projects that target .NET Framework with no RID set default to `win-x86` or `win-x64`.
28+
29+
## Type of breaking change
30+
31+
This change can affect [source compatibility](../../categories.md#source-compatibility).
32+
33+
## Reason for change
34+
35+
.NET Framework applications were getting a default RID that was incompatible with the portable RID graph. That incompatibility resulted in a restore error:
36+
37+
> Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1047: Assets file 'D:\1\s\artifacts\obj\MSBuild\project.assets.json' doesn't have a target for 'net472/win7-x64'. Ensure that restore has run and that you have included 'net472' in the TargetFrameworks for your project. You may also need to include 'win7-x64' in your project's RuntimeIdentifiers. \[MSBuild.csproj::TargetFramework=net472]>
38+
39+
For more information, see [dotnet/sdk issue #35575](https://github.com/dotnet/sdk/issues/35575).
40+
41+
## Recommended action
42+
43+
If you're affected by this change, choose one of the following actions:
44+
45+
- Update your runtime identifier to a value supported by the portable RID graph. Project file example:
46+
47+
```xml
48+
<PropertyGroup>
49+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
50+
</PropertyGroup>
51+
```
52+
53+
If you specify the RID as a command-line argument, make a similar change. For example, `dotnet publish --runtime win-x64`.
54+
55+
- Switch back to the old RID graph by setting `UseRidGraph` to `true` in the project file:
56+
57+
```xml
58+
<PropertyGroup>
59+
<UseRidGraph>true</UseRidGraph>
60+
</PropertyGroup>
61+
```
62+
63+
## Affected APIs
64+
65+
None.

docs/core/compatibility/toc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ items:
7676
items:
7777
- name: Deprecated desktop Windows/macOS/Linux MonoVM runtime packages
7878
href: deployment/9.0/monovm-packages.md
79+
- name: Entity Framework Core
80+
href: /ef/core/what-is-new/ef-core-9.0/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
7981
- name: Interop
8082
items:
8183
- name: CET supported by default
@@ -110,6 +112,8 @@ items:
110112
href: sdk/9.0/dotnet-workload-output.md
111113
- name: "`installer` repo version no longer documented"
112114
href: sdk/9.0/productcommits-versions.md
115+
- name: New default RID used when targeting .NET Framework
116+
href: sdk/9.0/default-rid.md
113117
- name: Terminal logger is default
114118
href: sdk/9.0/terminal-logger.md
115119
- name: Version requirements
@@ -1604,6 +1608,8 @@ items:
16041608
href: deployment/7.0/x86-host-path.md
16051609
- name: Entity Framework Core
16061610
items:
1611+
- name: EF Core 9
1612+
href: /ef/core/what-is-new/ef-core-9.0/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
16071613
- name: EF Core 8
16081614
href: /ef/core/what-is-new/ef-core-8.0/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
16091615
- name: EF Core 7
@@ -1810,6 +1816,8 @@ items:
18101816
href: sdk/9.0/dotnet-workload-output.md
18111817
- name: "`installer` repo version no longer documented"
18121818
href: sdk/9.0/productcommits-versions.md
1819+
- name: New default RID used when targeting .NET Framework
1820+
href: sdk/9.0/default-rid.md
18131821
- name: Terminal logger is default
18141822
href: sdk/9.0/terminal-logger.md
18151823
- name: Version requirements for .NET 9 SDK

0 commit comments

Comments
 (0)