Skip to content

Commit cea304a

Browse files
authored
Document breaking change: dotnet tool install --local creates manifest by default in .NET 10 (#48138)
1 parent 41312ce commit cea304a

File tree

4 files changed

+63
-12
lines changed

4 files changed

+63
-12
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
109109
| [`dotnet new sln` defaults to SLNX file format](sdk/10.0/dotnet-new-sln-slnx-default.md) | Behavioral change | RC 1 |
110110
| [`dotnet package list` performs restore](sdk/10.0/dotnet-package-list-restore.md) | Behavioral change | Preview 4 |
111111
| [`dotnet restore` audits transitive packages](sdk/10.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 3 |
112+
| [`dotnet tool install --local` creates manifest by default](sdk/10.0/dotnet-tool-install-local-manifest.md) | Behavioral change | Preview 7 |
112113
| [project.json not supported in `dotnet restore`](sdk/10.0/dotnet-restore-project-json-unsupported.md) | Source incompatible | Preview 7 |
113114
| [SHA-1 fingerprint support deprecated in `dotnet nuget sign`](sdk/10.0/dotnet-nuget-sign-sha1-deprecated.md) | Behavioral change | Preview 1 |
114115
| [MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed](sdk/10.0/custom-build-event-warning.md) | Behavioral change | Preview 1 |
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "Breaking change: 'dotnet tool install --local' creates manifest by default"
3+
description: "Learn about the breaking change where 'dotnet tool install --local' now creates a manifest by default if no tools manifest is found."
4+
ms.date: 08/27/2025
5+
ai-usage: ai-generated
6+
---
7+
8+
# dotnet tool install --local creates manifest by default
9+
10+
When running [`dotnet tool install --local`](../../../tools/dotnet-tool-install.md), a manifest is now created if none exists instead of failing with an error. This change was implemented by making the [`--create-manifest-if-needed` option](../../../tools/dotnet-tool-install.md#options) enabled by default. This is a breaking change, since users might have relied on the failure behavior to check if they needed to create a manifest.
11+
12+
The `-d` flag on `dotnet tool install` was previously added to show the locations that were searched for manifests. This information was relayed in the error given when there was no manifest. That error is no longer shown since a manifest is now created if necessary. You should no longer use the `-d` flag.
13+
14+
## Version introduced
15+
16+
.NET 10 Preview 7
17+
18+
## Previous behavior
19+
20+
Previously, if you tried to install a .NET tool as a local tool in a folder that didn't contain a manifest, you got an error:
21+
22+
> Cannot find a manifest file.
23+
24+
## New behavior
25+
26+
Starting in .NET 10, the `--create-manifest-if-needed=true` functionality is now enabled by default. When a tool is installed as a local tool, the manifest is created automatically if it doesn't exist. The manifest is created according to the rules described in the [`--create-manifest-if-needed` option](../../../tools/dotnet-tool-install.md#options) documentation.
27+
28+
## Type of breaking change
29+
30+
This change is a [behavioral change](../../categories.md#behavioral-change).
31+
32+
## Reason for change
33+
34+
This change improves the user experience by making `dotnet tool install --local` work by default without requiring users to manually create a manifest first. Previously, there was a concern about creating a manifest in a working directory rather than the repository root, but the tool now puts the manifest in the repository root when possible.
35+
36+
## Recommended action
37+
38+
You can turn off the automatic manifest creation behavior by passing `--create-manifest-if-needed=false` when calling `dotnet tool install --local`.
39+
40+
## Affected APIs
41+
42+
N/A
43+
44+
## See also
45+
46+
- [dotnet tool install](../../../tools/dotnet-tool-install.md)

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ items:
124124
href: sdk/10.0/dotnet-new-sln-slnx-default.md
125125
- name: "`dotnet package list` performs restore"
126126
href: sdk/10.0/dotnet-package-list-restore.md
127+
- name: "`dotnet tool install --local` creates manifest by default"
128+
href: sdk/10.0/dotnet-tool-install-local-manifest.md
127129
- name: MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed
128130
href: sdk/10.0/custom-build-event-warning.md
129131
- name: MSBuild custom culture resource handling

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: dotnet tool install command
33
description: The dotnet tool install command installs the specified .NET tool on your machine.
4-
ms.date: 04/07/2025
4+
ms.date: 08/27/2025
55
---
66
# dotnet tool install
77

@@ -46,9 +46,9 @@ dotnet tool install -h|--help
4646

4747
The `dotnet tool install` command provides a way for you to install .NET tools on your machine. To use the command, you specify one of the following installation options:
4848

49-
* To install a global tool in the default location, use the `--global` option.
50-
* To install a global tool in a custom location, use the `--tool-path` option.
51-
* To install a local tool, omit the `--global` and `--tool-path` options.
49+
- To install a global tool in the default location, use the `--global` option.
50+
- To install a global tool in a custom location, use the `--tool-path` option.
51+
- To install a local tool, omit the `--global` and `--tool-path` options.
5252

5353
> [!WARNING]
5454
> 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.
@@ -80,7 +80,7 @@ Tools with explicit tool paths are stored wherever you specified the `--tool-pat
8080

8181
Local tools are stored in the NuGet global directory, whatever you've set that to be. There are shim files in `$HOME/.dotnet/toolResolverCache` for each local tool that point to where the tools are within that location.
8282

83-
References to local tools are added to a *dotnet-tools.json* file in a *.config* directory under the current directory. If a manifest file doesn't exist yet, create it by using the `--create-manifest-if-needed` option or by running the following command:
83+
References to local tools are added to a *dotnet-tools.json* file in a *.config* directory under the current directory. Starting in .NET 10, if a manifest file doesn't exist yet, one is created automatically. You can also create one manually by running the following command:
8484

8585
```dotnetcli
8686
dotnet new tool-manifest
@@ -112,19 +112,21 @@ For more information, see [Install a local tool](global-tools.md#install-a-local
112112

113113
- **`--create-manifest-if-needed`**
114114

115-
Applies to local tools. Available starting with .NET 8 SDK. To find a manifest, the search algorithm searches up the directory tree for `dotnet-tools.json` or a `.config` folder that contains a `dotnet-tools.json` file.
115+
Available starting in .NET 8 SDK.
116116

117-
If a tool-manifest can't be found and the `--create-manifest-if-needed` option is set to false, the `CannotFindAManifestFile` error occurs.
117+
Applies to local tools. To find a manifest, the search algorithm searches up the directory tree for `dotnet-tools.json` or a `.config` folder that contains a `dotnet-tools.json` file.
118118

119-
If a tool-manifest can't be found and the `--create-manifest-if-needed` option is set to true, the tool creates a manifest automatically. It chooses a folder for the manifest as follows:
119+
If a tool-manifest can't be found and the `--create-manifest-if-needed` option is set to `false`, the `CannotFindAManifestFile` error occurs.
120120

121-
* Walk up the directory tree searching for a directory that has a `.git` subfolder. If one is found, create the manifest in that directory.
122-
* If the previous step doesn't find a directory, walk up the directory tree searching for a directory that has a `.sln` or `.git` file. If one is found, create the manifest in that directory.
123-
* If neither of the previous two steps finds a directory, create the manifest in the current working directory.
121+
If a tool-manifest can't be found and the `--create-manifest-if-needed` option is set to `true` (or, in .NET 10 and later versions, when not specified), the tool creates a manifest automatically. It chooses a folder for the manifest as follows:
122+
123+
- Walk up the directory tree searching for a directory that has a `.git` subfolder. If one is found, create the manifest in that directory.
124+
- If the previous step doesn't find a directory, walk up the directory tree searching for a directory that has a `.sln` or `.git` file. If one is found, create the manifest in that directory.
125+
- If neither of the previous two steps finds a directory, create the manifest in the current working directory.
124126

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

127-
Starting in .NET 10, this flag is applied automatically if no tools manifest is found.
129+
Starting in .NET 10, a manifest is created automatically if no tools manifest is found. This change can be a [breaking change](../compatibility/sdk/10.0/dotnet-tool-install-local-manifest.md). You can opt out by passing `--create-manifest-if-needed=false`.
128130

129131
> [!WARNING]
130132
> 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.

0 commit comments

Comments
 (0)