Skip to content

Commit 66b3da0

Browse files
committed
default RID breaking change
1 parent eb3cfae commit 66b3da0

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
@@ -96,6 +96,7 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff
9696
| Title | Type of change | Introduced version |
9797
|-------------------------------------------------------------------------------|-------------------|--------------------|
9898
| [`dotnet restore` audits transitive packages](sdk/9.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 6 |
99+
| [Default RID used when targeting .NET Framework](sdk/9.0/default-rid.md) | Source incompatible | GA |
99100
| [`dotnet watch` incompatible with Hot Reload for old frameworks](sdk/9.0/dotnet-watch.md) | Behavioral change | RC 1 |
100101
| [`dotnet workload` commands output change](sdk/9.0/dotnet-workload-output.md) | Behavioral change | Preview 1 |
101102
| [`installer` repo version no longer documented](sdk/9.0/productcommits-versions.md) | Behavioral change | Preview 5 |
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 the 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+
In the project file
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
@@ -68,6 +68,8 @@ items:
6868
items:
6969
- name: Deprecated desktop Windows/macOS/Linux MonoVM runtime packages
7070
href: deployment/9.0/monovm-packages.md
71+
- name: Entity Framework Core
72+
href: /ef/core/what-is-new/ef-core-9.0/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
7173
- name: Interop
7274
items:
7375
- name: CET supported by default
@@ -96,6 +98,8 @@ items:
9698
items:
9799
- name: "`dotnet restore` audits transitive packages"
98100
href: sdk/9.0/nugetaudit-transitive-packages.md
101+
- name: Default RID used when targeting .NET Framework
102+
href: sdk/9.0/default-rid.md
99103
- name: "`dotnet watch` incompatible with Hot Reload for old frameworks"
100104
href: sdk/9.0/dotnet-watch.md
101105
- name: "`dotnet workload` commands output change"
@@ -1584,6 +1588,8 @@ items:
15841588
href: deployment/7.0/x86-host-path.md
15851589
- name: Entity Framework Core
15861590
items:
1591+
- name: EF Core 9
1592+
href: /ef/core/what-is-new/ef-core-9.0/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
15871593
- name: EF Core 8
15881594
href: /ef/core/what-is-new/ef-core-8.0/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
15891595
- name: EF Core 7
@@ -1784,6 +1790,8 @@ items:
17841790
items:
17851791
- name: "`dotnet restore` audits transitive packages"
17861792
href: sdk/9.0/nugetaudit-transitive-packages.md
1793+
- name: Default RID used when targeting .NET Framework
1794+
href: sdk/9.0/default-rid.md
17871795
- name: "`dotnet watch` incompatible with Hot Reload for old frameworks"
17881796
href: sdk/9.0/dotnet-watch.md
17891797
- name: "`dotnet workload` commands output change"

0 commit comments

Comments
 (0)