From d8ea0ebd5fdc6e53a040c84fd760e09991d1c24d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 21:11:13 +0000 Subject: [PATCH 1/9] Initial plan From da16212623b8a562b1b2be43354e2377160592c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 21:13:08 +0000 Subject: [PATCH 2/9] Document #:include support for 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> --- docs/core/sdk/file-based-apps.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index 0ff2a73c00b4f..d09cb38d0e1dc 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -1,7 +1,7 @@ --- title: File-based apps description: Learn how to create, build, and run C# applications from a single file without a project file. -ms.date: 12/05/2025 +ms.date: 04/22/2026 ai-usage: ai-assisted --- # File-based apps @@ -21,7 +21,7 @@ In this article, learn how to create, configure, and work with file-based apps e ## 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. ### `#:package` @@ -44,6 +44,17 @@ References another project file or directory that contains a project file. #:project ../SharedLibrary/SharedLibrary.csproj ``` +### `#:include` + +Includes another C# source file in your 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. + ### `#:property` Sets an MSBuild property value. @@ -215,6 +226,7 @@ Different SDKs include other file types: - `Microsoft.NET.Sdk.Web` includes `*.json` configuration files. - Non-default SDKs include ResX resource files. +- Files referenced by `#:include` are included for compilation. ## Native AOT publishing From dce1256437e21c2ec0810df50c2fc4460561ccb6 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:59:29 -0700 Subject: [PATCH 3/9] Reorganize supported directives in file-based apps docs Reordered the list of supported directives for clarity and moved the `#:project` section to a new position. --- docs/core/sdk/file-based-apps.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index d09cb38d0e1dc..605ad95006914 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -21,7 +21,7 @@ In this article, learn how to create, configure, and work with file-based apps e ## Supported directives -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. +File-based apps use directives prefixed with `#:` to configure the build and run the application. Supported directives are: `#:include`, `#:package`, `#:project`, `#:property`, and `#:sdk`. Place these directives at the top of the C# file. ### `#:package` @@ -36,17 +36,9 @@ Adds a NuGet package reference to your application. > [!NOTE] > Omitting the version number after the package name currently only works when you use central package management with a `Directory.Packages.props` file. Otherwise, specify the version number explicitly, or add `@*` after the package name to use the latest version. -### `#:project` - -References another project file or directory that contains a project file. - -```csharp -#:project ../SharedLibrary/SharedLibrary.csproj -``` - ### `#:include` -Includes another C# source file in your file-based app. +Includes another C# source file in the file-based app. ```csharp #:include helpers.cs @@ -55,6 +47,14 @@ Includes another C# source file in your file-based app. The `#:include` directive is available in .NET 11 Preview 3 and .NET SDK 10.0.3xx and later. +### `#:project` + +References another project file or directory that contains a project file. + +```csharp +#:project ../SharedLibrary/SharedLibrary.csproj +``` + ### `#:property` Sets an MSBuild property value. From c26788a4c8dae77d7de5f43b1fae2cfa5a53797d Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Apr 2026 15:00:15 -0700 Subject: [PATCH 4/9] Remove duplicate `#:include` directive section Removed duplicate section for the `#:include` directive in the documentation. --- docs/core/sdk/file-based-apps.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index 605ad95006914..5914215c7e794 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -23,6 +23,17 @@ In this article, learn how to create, configure, and work with file-based apps e File-based apps use directives prefixed with `#:` to configure the build and run the application. Supported directives are: `#:include`, `#:package`, `#:project`, `#:property`, and `#:sdk`. Place these directives at the top of the C# file. +### `#: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. + ### `#:package` Adds a NuGet package reference to your application. @@ -36,17 +47,6 @@ Adds a NuGet package reference to your application. > [!NOTE] > Omitting the version number after the package name currently only works when you use central package management with a `Directory.Packages.props` file. Otherwise, specify the version number explicitly, or add `@*` after the package name to use the latest version. -### `#: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. - ### `#:project` References another project file or directory that contains a project file. From 45e2f60e53fb44d911067399fd43d8c4510cd136 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Apr 2026 15:02:26 -0700 Subject: [PATCH 5/9] Update docs/core/sdk/file-based-apps.md --- docs/core/sdk/file-based-apps.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index 5914215c7e794..83515d57e8d8e 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -226,7 +226,6 @@ Different SDKs include other file types: - `Microsoft.NET.Sdk.Web` includes `*.json` configuration files. - Non-default SDKs include ResX resource files. -- Files referenced by `#:include` are included for compilation. ## Native AOT publishing From 94d3ead437f04d38ac0acd84e510ce41a15cbf8c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:07:47 +0000 Subject: [PATCH 6/9] Clarify #:include compilation behavior in file-based apps docs Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- docs/core/sdk/file-based-apps.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index 83515d57e8d8e..a1514742b55b8 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -27,6 +27,8 @@ File-based apps use directives prefixed with `#:` to configure the build and run Includes another C# source file in the file-based app. +Included files compile as part of the same app, so they can add types and top-level statements. + ```csharp #:include helpers.cs #:include models/customer.cs From b5f492a550b0d8f69c41f85dedf0e41d0ff9f09a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:08:13 +0000 Subject: [PATCH 7/9] Refine #:include clarification wording for list clarity Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- docs/core/sdk/file-based-apps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index a1514742b55b8..d6b215fab942f 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -27,7 +27,7 @@ File-based apps use directives prefixed with `#:` to configure the build and run Includes another C# source file in the file-based app. -Included files compile as part of the same app, so they can add types and top-level statements. +Included files compile as part of the same app, so they can add types, top-level statements, and other declarations. ```csharp #:include helpers.cs From 70062cfe2cd35bb65206ce2145404e3ea2a154b1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:08:40 +0000 Subject: [PATCH 8/9] Adjust include clarification phrasing Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- docs/core/sdk/file-based-apps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index d6b215fab942f..0b1472a4f585b 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -27,7 +27,7 @@ File-based apps use directives prefixed with `#:` to configure the build and run Includes another C# source file in the file-based app. -Included files compile as part of the same app, so they can add types, top-level statements, and other declarations. +Included files compile as part of the same app, and they can add types, top-level statements, and other declarations. ```csharp #:include helpers.cs From 95713a7148bac189d4840464ebac01c1ea9e778c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:09:05 +0000 Subject: [PATCH 9/9] Split include clarification into two sentences Agent-Logs-Url: https://github.com/dotnet/docs/sessions/a2dfc33b-80ca-4bce-a649-cb0f6ef97058 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- docs/core/sdk/file-based-apps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/sdk/file-based-apps.md b/docs/core/sdk/file-based-apps.md index 0b1472a4f585b..69c54fb3d3e55 100644 --- a/docs/core/sdk/file-based-apps.md +++ b/docs/core/sdk/file-based-apps.md @@ -27,7 +27,7 @@ File-based apps use directives prefixed with `#:` to configure the build and run Includes another C# source file in the file-based app. -Included files compile as part of the same app, and they can add types, top-level statements, and other declarations. +Included files compile as part of the same app. They can add types, top-level statements, and other declarations. ```csharp #:include helpers.cs