Skip to content

Commit 8c39457

Browse files
authored
Update doc about global.json to include new properties for SDK resolution (#45614)
1 parent fcd2624 commit 8c39457

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/core/tools/global-json.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ The following table shows the possible values for the `rollForward` key:
8686
| `latestMajor` | Uses the highest installed .NET SDK with a version that's greater than or equal to the specified value. <br> If not found, fail. |
8787
| `disable` | Doesn't roll forward. An exact match is required. |
8888

89+
#### paths
90+
91+
- Type: Array of `string`
92+
- Available since: .NET 10 Preview 3 SDK.
93+
94+
Specifies additional locations that should be considered when searching for a compatible .NET SDK. Paths can be absolute or relative to the location of the *global.json* file. The special value `$host$` represents the location corresponding to the running `dotnet` executable.
95+
96+
These paths are searched in the order they're defined and the first [matching](#matching-rules) SDK is used.
97+
98+
#### errorMessage
99+
100+
- Type: `string`
101+
- Available since: .NET 10 Preview 3 SDK.
102+
103+
Specifies a custom error message displayed when the SDK resolver can't find a compatible .NET SDK.
104+
89105
### msbuild-sdks
90106

91107
Type: `object`
@@ -163,6 +179,18 @@ The following example shows how to use the highest patch version installed of a
163179
}
164180
```
165181

182+
The following example shows how to specify additional SDK search paths and a custom error message:
183+
184+
```json
185+
{
186+
"sdk": {
187+
"version": "10.0.100",
188+
"paths": [ ".dotnet", "$host$" ],
189+
"errorMessage": "The required .NET SDK wasn't found. Please run ./install.sh to install it."
190+
}
191+
}
192+
```
193+
166194
## global.json and the .NET CLI
167195

168196
To set an SDK version in the *global.json* file, it's helpful to know which SDK versions are installed on your machine. For information on how to do that, see [How to check that .NET is already installed](../install/how-to-detect-installed-versions.md#check-sdk-versions).

0 commit comments

Comments
 (0)