Skip to content

Commit 6c4d329

Browse files
authored
Document breaking change: Double quotes disallowed in file-level directives (#49608)
1 parent d7c8560 commit 6c4d329

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
119119
| [.NET tool packaging creates RuntimeIdentifier-specific tool packages](sdk/10.0/dotnet-tool-pack-publish.md) | Behavioral change | Preview 6 |
120120
| [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 |
121121
| [dnx.ps1 file is no longer included in .NET SDK](sdk/10.0/dnx-ps1-removed.md) | Source incompatible | GA |
122+
| [Double quotes in file-level directives are disallowed](sdk/10.0/file-level-directive-double-quotes.md) | Source incompatible | GA |
122123
| [`dotnet new sln` defaults to SLNX file format](sdk/10.0/dotnet-new-sln-slnx-default.md) | Behavioral change | RC 1 |
123124
| [`dotnet package list` performs restore](sdk/10.0/dotnet-package-list-restore.md) | Behavioral change | Preview 4 |
124125
| [`dotnet restore` audits transitive packages](sdk/10.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 3 |
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: "Breaking change - Double quotes in file-level directives are disallowed"
3+
description: "Learn about the breaking change in .NET 10 where double quotes in file-level directives are disallowed."
4+
ms.date: 11/04/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/48916
7+
---
8+
9+
# Double quotes in file-level directives are disallowed
10+
11+
Usage of double quotes `"` inside `#:` file-level directives is now a build-time error when running file-based apps (for example, `dotnet run app.cs`).
12+
13+
## Version introduced
14+
15+
.NET 10 GA
16+
17+
## Previous behavior
18+
19+
In .NET 10 RC2 and older .NET 10 previews, quotes in directives weren't blocked but they didn't work as expected. They were only escaped as any other special character and passed to MSBuild. For example, `#:property Prop="my test"` resulted in `<Prop>&quot;my test&quot;</Prop>`.
20+
21+
## New behavior
22+
23+
An error is reported if a double quote `"` is encountered in any file-level directive. The error message is:
24+
25+
> Directives currently cannot contain double quotes (").
26+
27+
## Type of breaking change
28+
29+
This change can affect [source compatibility](../../categories.md#source-compatibility).
30+
31+
## Reason for change
32+
33+
This change enables future support for quoted directives without introducing a breaking change. This also improves the error recovery experience if users try to use quotes now, thinking that's supported syntax.
34+
35+
## Recommended action
36+
37+
Don't use quotes in `#:` directives. If you really need to use a double quote (or another special character that currently isn't supported, like trailing whitespace), move the corresponding project metadata entry into a `Directory.Build.props` file instead (it will be picked up by the file-based app). Or, convert the file-based app to a full project via `dotnet project convert`.
38+
39+
## Affected APIs
40+
41+
None.

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ items:
134134
href: sdk/10.0/dotnet-tool-pack-publish.md
135135
- name: dnx.ps1 file is no longer included in .NET SDK
136136
href: sdk/10.0/dnx-ps1-removed.md
137+
- name: Double quotes in file-level directives are disallowed
138+
href: sdk/10.0/file-level-directive-double-quotes.md
137139
- name: "`dotnet restore` audits transitive packages"
138140
href: sdk/10.0/nugetaudit-transitive-packages.md
139141
- name: project.json not supported in `dotnet restore`

0 commit comments

Comments
 (0)