From adb634dee304fe18a98cae1b512565e4e0a0ad8a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 29 Aug 2025 19:21:02 +0000 Subject: [PATCH 1/4] Initial plan From b3928f59b07c4ad931b8b28875d33c8a1229c3ac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 29 Aug 2025 19:30:10 +0000 Subject: [PATCH 2/4] Add documentation for buildprops, buildtargets, and sln templates Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- docs/core/tools/dotnet-new-sdk-templates.md | 35 ++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/core/tools/dotnet-new-sdk-templates.md b/docs/core/tools/dotnet-new-sdk-templates.md index 9c760d993bb7a..6d8e58ff81aab 100644 --- a/docs/core/tools/dotnet-new-sdk-templates.md +++ b/docs/core/tools/dotnet-new-sdk-templates.md @@ -3,7 +3,7 @@ title: .NET default templates for dotnet new description: The information about dotnet new templates shipped with dotnet SDK. ms.custom: updateeachrelease no-loc: [Blazor, WebAssembly] -ms.date: 02/21/2024 +ms.date: 08/29/2024 --- # .NET default templates for dotnet new @@ -21,6 +21,30 @@ Each template may have additional options available. To show the additional opti In case the template supports multiple languages, this command will show help for the template in the default language. By combining it with the `--language` option, you can see the help for other languages: `dotnet new console --help --language F#`. The templates that ship with the .NET SDK have the following additional options: +## `buildprops` + +Creates a *Directory.Build.props* file for customizing MSBuild properties for an entire folder tree. For more information, see [Customize your build](/visualstudio/msbuild/customize-your-build). + +- **`--inherit`** + + If specified, adds an Import element for the closest *Directory.Build.props* file in the parent directory hierarchy. By default, *Directory.Build.props* files don't inherit from parent directories, so enabling this option allows you to build up a hierarchy of customizations folder-by-folder. + +- **`--use-artifacts`** + + If specified, adds a property to enable the artifacts output layout. This is a common pattern for projects that produce build artifacts, such as NuGet packages, that are placed in a common folder structure. + +*** + +## `buildtargets` + +Creates a *Directory.Build.targets* file for customizing MSBuild targets and tasks for an entire folder tree. For more information, see [Customize your build](/visualstudio/msbuild/customize-your-build). + +- **`--inherit`** + + If specified, adds an Import element for the closest *Directory.Build.targets* file in the parent directory hierarchy. By default, *Directory.Build.targets* files don't inherit from parent directories, so enabling this option allows you to build up a hierarchy of customizations folder-by-folder. + +*** + ## `console` - **`-f|--framework `** @@ -901,6 +925,15 @@ API Controller with or without read/write actions. The roll-forward policy to use when selecting an SDK version, either as a fallback when a specific SDK version is missing or as a directive to use a later version. For more information, see [global-json](global-json.md#rollforward). +## `sln` + +Creates an empty solution file containing no projects. + +> [!NOTE] +> In .NET SDK 9.0.200 and later, this template supports a `--format` option to choose between `sln` and `slnx` formats. Starting with .NET 10, the default format will be `slnx`. + +*** + ## `editorconfig` Creates an *.editorconfig* file for configuring code style preferences. From 4891e45ad811452086dcbc8e4c48f7c0e0b66a65 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 29 Aug 2025 19:38:28 +0000 Subject: [PATCH 3/4] Add new templates to table of contents and reference artifacts documentation Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- docs/core/tools/dotnet-new-sdk-templates.md | 2 +- includes/templates.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/core/tools/dotnet-new-sdk-templates.md b/docs/core/tools/dotnet-new-sdk-templates.md index 6d8e58ff81aab..9ddd3aa2408af 100644 --- a/docs/core/tools/dotnet-new-sdk-templates.md +++ b/docs/core/tools/dotnet-new-sdk-templates.md @@ -31,7 +31,7 @@ Creates a *Directory.Build.props* file for customizing MSBuild properties for an - **`--use-artifacts`** - If specified, adds a property to enable the artifacts output layout. This is a common pattern for projects that produce build artifacts, such as NuGet packages, that are placed in a common folder structure. + If specified, adds a property to enable the artifacts output layout. This is a common pattern for projects that produce build artifacts, such as NuGet packages, that are placed in a common folder structure. For more information, see [Artifacts output layout](../sdk/artifacts-output.md). *** diff --git a/includes/templates.md b/includes/templates.md index 0a6f149a8b212..6ff82c69199e5 100644 --- a/includes/templates.md +++ b/includes/templates.md @@ -35,7 +35,9 @@ The following table shows the templates that come pre-installed with the .NET SD | NuGet Config | `nugetconfig` | | Config | 1.0 | | Dotnet local tool manifest file | `tool-manifest` | | Config | 3.0 | | Web Config | `webconfig` | | Config | 1.0 | -| Solution File | `sln` | | Solution | 1.0 | +| Directory.Build.props file | [`buildprops`](../docs/core/tools/dotnet-new-sdk-templates.md#buildprops) | | Config | 8.0.100 | +| Directory.Build.targets file | [`buildtargets`](../docs/core/tools/dotnet-new-sdk-templates.md#buildtargets) | | Config | 8.0.100 | +| Solution File | [`sln`](../docs/core/tools/dotnet-new-sdk-templates.md#sln) | | Solution | 1.0 | | Protocol Buffer File | [`proto`](../docs/core/tools/dotnet-new-sdk-templates.md#namespace) | | Web/gRPC | 3.0 | | EditorConfig file | [`editorconfig`](../docs/core/tools/dotnet-new-sdk-templates.md#editorconfig) | | Config | 6.0 | From adf67303b4bcb0f0002dee15e3bf4393c2ae9a8b Mon Sep 17 00:00:00 2001 From: "Andy (Steve) De George" <67293991+adegeo@users.noreply.github.com> Date: Thu, 4 Sep 2025 09:06:07 -0700 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/tools/dotnet-new-sdk-templates.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/core/tools/dotnet-new-sdk-templates.md b/docs/core/tools/dotnet-new-sdk-templates.md index 9ddd3aa2408af..31e82674fecaf 100644 --- a/docs/core/tools/dotnet-new-sdk-templates.md +++ b/docs/core/tools/dotnet-new-sdk-templates.md @@ -3,9 +3,9 @@ title: .NET default templates for dotnet new description: The information about dotnet new templates shipped with dotnet SDK. ms.custom: updateeachrelease no-loc: [Blazor, WebAssembly] -ms.date: 08/29/2024 +ms.date: 08/29/2025 --- -# .NET default templates for dotnet new +# Default templates for `dotnet new` When you install the [.NET SDK](https://dotnet.microsoft.com/download), you receive over a dozen built-in templates for creating projects and files, including console apps, class libraries, unit test projects, ASP.NET Core apps (including [Angular](https://angular.io/) and [React](https://reactjs.org/) projects), and configuration files. To list the built-in templates, run the `dotnet new list` command: @@ -19,7 +19,7 @@ dotnet new list Each template may have additional options available. To show the additional options available for the template use the `--help` option with the template name argument, for example: `dotnet new console --help`. In case the template supports multiple languages, this command will show help for the template in the default language. By combining it with the `--language` option, you can see the help for other languages: `dotnet new console --help --language F#`. -The templates that ship with the .NET SDK have the following additional options: +The templates that ship with the .NET SDK have additional options that are described in the following sections. ## `buildprops` @@ -930,7 +930,7 @@ API Controller with or without read/write actions. Creates an empty solution file containing no projects. > [!NOTE] -> In .NET SDK 9.0.200 and later, this template supports a `--format` option to choose between `sln` and `slnx` formats. Starting with .NET 10, the default format will be `slnx`. +> In .NET SDK 9.0.200 and later, this template supports a `--format` option to choose between `sln` and `slnx` formats. Starting with .NET 10, the default format is `slnx`. ***