-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document breaking change: Double quotes disallowed in file-level directives #49608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+44
−0
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
94e369d
Initial plan
Copilot b851024
Add breaking change documentation for double quotes in file-level dir…
Copilot 65a8350
Fix XML example typo: add missing semicolon
Copilot e72622f
Apply suggestions from code review
gewarren d085f5a
Apply suggestions from code review
gewarren 41da242
Update docs/core/compatibility/sdk/10.0/file-level-directive-double-q…
gewarren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
docs/core/compatibility/sdk/10.0/file-level-directive-double-quotes.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| title: "Breaking change - Double quotes in file-level directives are disallowed" | ||
| description: "Learn about the breaking change in .NET 10 where double quotes in file-level directives are disallowed." | ||
| ms.date: 11/04/2025 | ||
| ai-usage: ai-assisted | ||
| ms.custom: https://github.com/dotnet/docs/issues/48916 | ||
| --- | ||
|
|
||
| # Double quotes in file-level directives are disallowed | ||
|
|
||
| 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`). | ||
|
|
||
| ## Version introduced | ||
|
|
||
| .NET 10 GA | ||
|
|
||
| ## Previous behavior | ||
|
|
||
| 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>"my test"</Prop>`. | ||
|
|
||
| ## New behavior | ||
|
|
||
| An error is reported if a double quote `"` is encountered in any file-level directive. The error message is: | ||
|
|
||
| > Directives currently cannot contain double quotes ("). | ||
|
|
||
| ## Type of breaking change | ||
|
|
||
| This change can affect [source compatibility](../../categories.md#source-compatibility). | ||
|
|
||
| ## Reason for change | ||
|
|
||
| This change was made so support can be added later 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. | ||
gewarren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
gewarren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Recommended action | ||
|
|
||
| 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`. | ||
gewarren marked this conversation as resolved.
Show resolved
Hide resolved
gewarren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Affected APIs | ||
|
|
||
| None. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.