diff --git a/docs/core/distribution-packaging.md b/docs/core/distribution-packaging.md index 25fe7e3618e1f..b60f9f19f1901 100644 --- a/docs/core/distribution-packaging.md +++ b/docs/core/distribution-packaging.md @@ -18,6 +18,7 @@ When installed, .NET consists of several components that are laid out as follows ``` {dotnet_root} (0) (*) ├── dotnet (1) +├── dnx (22) ├── LICENSE.txt (8) ├── ThirdPartyNotices.txt (8) ├── host (*) @@ -69,12 +70,15 @@ When installed, .NET consists of several components that are laid out as follows │ └── dotnet.1.gz (9) └── usr/bin └── dotnet (10) + └── dnx (23) ``` - (0) **{dotnet_root}** is a shared root for all .NET major and minor versions. If multiple runtimes are installed, they share the **{dotnet_root}** folder, for example, `{dotnet_root}/shared/Microsoft.NETCore.App/6.0.11` and `{dotnet_root}/shared/Microsoft.NETCore.App/7.0.0`. The name of the `{dotnet_root}` folder should be version agnostic, that is, simply `dotnet`. - (1) **dotnet** The host (also known as the "muxer") has two distinct roles: activate a runtime to launch an application, and activate an SDK to dispatch commands to it. The host is a native executable (`dotnet.exe`). +- (22) **dnx** The `dnx` script is an executable shell script whose purpose is to foward along user commands to the `dotnet dnx` command inside an SDK. This functionality primarily exists to make acquiring and launching various kinds of .NET applications, like .NET Tools, easier for end-users. Think of it similarly to the `npx` command from Node. It is version-independent since most of the actual functionality of the `dnx` one-shot execution process is handled in the `dotnet` CLI implementation in the versioned SDK directory. + While there's a single host, most of the other components are in versioned directories (2,3,5,6). This means multiple versions can be present on the system since they're installed side by side. - (2) **host/fxr/\** contains the framework resolution logic used by the host. The host uses the latest hostfxr that is installed. The hostfxr is responsible for selecting the appropriate runtime when executing a .NET application. For example, an application built for .NET 7.0.0 uses the 7.0.5 runtime when it's available. Similarly, hostfxr selects the appropriate SDK during development. @@ -93,7 +97,7 @@ The **shared** folder contains frameworks. A shared framework provides a set of - (8) **LICENSE.txt,ThirdPartyNotices.txt** are the .NET license and licenses of third-party libraries used in .NET, respectively. -- (9,10) **dotnet.1.gz, dotnet** `dotnet.1.gz` is the dotnet manual page. `dotnet` is a symlink to the dotnet host(1). These files are installed at well-known locations for system integration. +- (9,10, 23) **dotnet.1.gz, dotnet** `dotnet.1.gz` is the dotnet manual page. `dotnet` is a symlink to the dotnet host(1). `dnx` is a symlink to the `dnx` shell script (22). These files are installed at well-known locations for system integration. - (11,12) **Microsoft.NETCore.App.Ref,Microsoft.AspNetCore.App.Ref** describe the API of an `x.y` version of .NET and ASP.NET Core respectively. These packs are used when compiling for those target versions. @@ -171,7 +175,7 @@ The following lists the recommended packages: - `dotnet-host` - dependency - **Version:** \ - **Example:** dotnet-host - - **Contains:** (1),(8),(9),(10),(16) + - **Contains:** (1),(8),(9),(10),(16),(22),(23) - `dotnet-apphost-pack-[major].[minor]` - dependency - **Version:** \ diff --git a/docs/core/tools/dotnet-new-sdk-templates.md b/docs/core/tools/dotnet-new-sdk-templates.md index 9c760d993bb7a..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: 02/21/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,31 @@ 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` + +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. For more information, see [Artifacts output layout](../sdk/artifacts-output.md). + +*** + +## `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` @@ -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 is `slnx`. + +*** + ## `editorconfig` Creates an *.editorconfig* file for configuring code style preferences. 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 |