Skip to content

Document #:include support in file-based apps#53350

Open
Copilot wants to merge 9 commits intomainfrom
copilot/update-file-based-apps-article
Open

Document #:include support in file-based apps#53350
Copilot wants to merge 9 commits intomainfrom
copilot/update-file-based-apps-article

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

The file-based apps article was missing the new #:include directive 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

    • Added #:include to the top-level list of supported file-based app directives.
  • New #:include directive section

    • Added dedicated documentation for #:include.
    • Included syntax examples for including files from the app root and subfolders.
    • Added version availability note: .NET 11 Preview 3 and .NET SDK 10.0.3xx+.
  • Default included items clarification

    • Documented that files referenced by #:include are included in compilation.
#:include helpers.cs
#:include models/customer.cs

Console.WriteLine("Hello!");

Internal previews

📄 File 🔗 Preview link
docs/core/sdk/file-based-apps.md File-based apps

Agent-Logs-Url: https://github.com/dotnet/docs/sessions/27329bc4-87c0-469b-b146-55d906707455

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI changed the title [WIP] Update article on file-based apps with include syntax Document #:include support in file-based apps Apr 22, 2026
Copilot AI requested a review from gewarren April 22, 2026 21:14
Comment thread docs/core/sdk/file-based-apps.md Outdated
## 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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert alphabetically.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 45e2f60. The supported directives list and directive sections are now ordered alphabetically.

Comment thread docs/core/sdk/file-based-apps.md Outdated
Comment thread docs/core/sdk/file-based-apps.md Outdated

### `#:include`

Includes another C# source file in your file-based app.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Includes another C# source file in your file-based app.
Includes another C# source file in the file-based app.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 45e2f60. The sentence now reads: “Includes another C# source file in the file-based app.”

@gewarren
Copy link
Copy Markdown
Contributor

@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.
Comment thread docs/core/sdk/file-based-apps.md Outdated
@gewarren gewarren marked this pull request as ready for review April 22, 2026 22:03
@gewarren gewarren requested a review from a team as a code owner April 22, 2026 22:03
Copilot AI review requested due to automatic review settings April 22, 2026 22:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 #:include to the supported directives list.
  • Adds a new #:include subsection with examples and an availability note.

Comment on lines +26 to +35
### `#: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.
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 95713a7. I added clarification that included files compile as part of the same app and can add declarations.

Copilot AI and others added 4 commits April 22, 2026 22:07
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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 22, 2026

@copilot Please respond to feedback.

Done—feedback has been applied in 95713a7.

Copilot AI requested a review from gewarren April 22, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File-based apps can include other code files

3 participants