Document #:include support in file-based apps#53350
Conversation
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/27329bc4-87c0-469b-b146-55d906707455 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
#:include support in file-based apps
| ## Supported directives | ||
|
|
||
| File-based apps use directives prefixed with `#:` to configure the build and run the application. Supported directives include: `#:package`, `#:project`, `#:property`, and `#:sdk`. Place these directives at the top of the C# file. | ||
| File-based apps use directives prefixed with `#:` to configure the build and run the application. Supported directives include: `#:package`, `#:project`, `#:include`, `#:property`, and `#:sdk`. Place these directives at the top of the C# file. |
There was a problem hiding this comment.
Addressed in 45e2f60. The supported directives list and directive sections are now ordered alphabetically.
|
|
||
| ### `#:include` | ||
|
|
||
| Includes another C# source file in your file-based app. |
There was a problem hiding this comment.
| Includes another C# source file in your file-based app. | |
| Includes another C# source file in the file-based app. |
There was a problem hiding this comment.
Applied in 45e2f60. The sentence now reads: “Includes another C# source file in the file-based app.”
|
@copilot Please respond to feedback. |
Reordered the list of supported directives for clarity and moved the `#:project` section to a new position.
Removed duplicate section for the `#:include` directive in the documentation.
There was a problem hiding this comment.
Pull request overview
Updates the file-based apps documentation to cover the newly supported #:include directive so developers can split a file-based app across multiple source files.
Changes:
- Adds
#:includeto the supported directives list. - Adds a new
#:includesubsection with examples and an availability note.
| ### `#:include` | ||
|
|
||
| Includes another C# source file in the file-based app. | ||
|
|
||
| ```csharp | ||
| #:include helpers.cs | ||
| #:include models/customer.cs | ||
| ``` | ||
|
|
||
| The `#:include` directive is available in .NET 11 Preview 3 and .NET SDK 10.0.3xx and later. |
There was a problem hiding this comment.
The new #:include section doesn't currently explain how included files participate in compilation (for example, that the included source is compiled as part of the same app and can contribute types/top-level statements). That detail is called out in the PR description, so consider adding one clarifying sentence here to avoid ambiguity about what "includes" means.
There was a problem hiding this comment.
Applied in 95713a7. I added clarification that included files compile as part of the same app and can add declarations.
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
The file-based apps article was missing the new
#:includedirective introduced with .NET 11 Preview 3 and backported to .NET SDK 10.0.3xx. This update adds directive coverage and clarifies how included source files participate in compilation.Supported directives
#:includeto the top-level list of supported file-based app directives.New
#:includedirective section#:include.Default included items clarification
#:includeare included in compilation.Internal previews