Skip to content

Commit 7a4645f

Browse files
Update the .NET tools documentation based on a review of the code. (#47675)
* Update the .NET tools documentation based on a review of the code. * PR feedback Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: Genevieve Warren <[email protected]>
1 parent c751c9e commit 7a4645f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

docs/core/tools/dotnet-tool-install.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ The `dotnet tool install` command provides a way for you to install .NET tools o
5050
* To install a global tool in a custom location, use the `--tool-path` option.
5151
* To install a local tool, omit the `--global` and `--tool-path` options.
5252

53+
> [!WARNING]
54+
> Make sure the directory you specify with the `--tool-path` option is secure. Tools installed in this location can be executed directly, so using an untrusted or shared path might introduce security risks.
55+
5356
## Installation locations
5457

5558
### Global tools
@@ -121,6 +124,11 @@ For more information, see [Install a local tool](global-tools.md#install-a-local
121124

122125
For more information on how manifests are located, see [Install a local tool](global-tools.md#install-a-local-tool).
123126

127+
Starting in .NET 10, this flag is applied automatically if no tools manifest is found.
128+
129+
> [!WARNING]
130+
> Don't run tool commands from the **Downloads** folder or any shared location. The CLI walks up the directory tree to find a tool manifest, which might cause it to use a manifest you don't expect. Always run tool commands from a trusted, project-specific directory.
131+
124132
- **`--disable-parallel`**
125133

126134
Prevent restoring multiple projects in parallel.

docs/core/tools/global-tools-how-to-create.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ Before you can pack and distribute the application as a tool, you need to modify
177177

178178
`<ToolCommandName>` is an optional element that specifies the command that will invoke the tool after it's installed. If this element isn't provided, the command name for the tool is the assembly name, which is typically the project file name without the *.csproj* extension.
179179

180+
> [!NOTE]
181+
> Choose a unique value for `<ToolCommandName>`. Avoid using file extensions (like `.exe` or `.cmd`) because the tool is installed as an app host and the command should not include an extension. This helps prevent conflicts with existing commands and ensures a smooth installation experience.
182+
180183
`<PackageOutputPath>` is an optional element that determines where the NuGet package will be produced. The NuGet package is what the .NET CLI uses to install your tool.
181184

182185
The project file now looks like the following example:

docs/core/tools/global-tools.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ dotnet new tool-manifest
108108

109109
This command creates a manifest file named *dotnet-tools.json* under the *.config* directory. To add a local tool to the manifest file, use the [dotnet tool install](dotnet-tool-install.md) command and **omit** the `--global` and `--tool-path` options, as shown in the following example:
110110

111+
> [!WARNING]
112+
> Make sure the tool manifest file is stored in a controlled location. The .NET CLI launches local tools with `dotnet tool run` based on the contents of the tool manifest. If the manifest is modified by an untrusted party, it could cause the CLI to run malicious code.
113+
111114
```dotnetcli
112115
dotnet tool install dotnetsay
113116
```

0 commit comments

Comments
 (0)