Skip to content

Commit 3ed2243

Browse files
baronfelCopilotgewarren
authored
Tweak the wording on DOTNET_HOST_PATH docs to align with the new world (#49422)
* Tweak the wording on DOTNET_HOST_PATH docs to align with the new world In .NET 10 / VS2026 we have a new invariant for DOTNET_HOST_PATH in builds that we should document * Update docs/core/tools/dotnet-environment-variables.md Co-authored-by: Copilot <[email protected]> * Update docs/core/tools/dotnet-environment-variables.md Co-authored-by: Copilot <[email protected]> * Fix whitespace * Update docs/core/tools/dotnet-environment-variables.md Co-authored-by: Genevieve Warren <[email protected]> * Update docs/core/tools/dotnet-environment-variables.md Co-authored-by: Genevieve Warren <[email protected]> * Re-add NOTE --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Genevieve Warren <[email protected]>
1 parent 524ef30 commit 3ed2243

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

docs/core/tools/dotnet-environment-variables.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,13 @@ These environment variables are used only when running apps via generated execut
183183

184184
### `DOTNET_HOST_PATH`
185185

186-
Specifies the absolute path to a `dotnet` host (`dotnet.exe` on Windows, `dotnet` on Linux and macOS) that was used to launch the currently-running `dotnet` process. This is used by the .NET SDK to help tools that run during .NET SDK commands ensure they use the same `dotnet` runtime for any child `dotnet` processes they create for the duration of the command. Tools and MSBuild Tasks within the SDK that invoke binaries via the `dotnet` host are expected to honor this environment variable to ensure a consistent experience.
186+
Specifies the absolute path to a `dotnet` host (`dotnet.exe` on Windows, `dotnet` on Linux and macOS). This path represents either the host used to launch the currently running `dotnet` process, or the host that would be used when running `dotnet` commands for the currently building project when executing under MSBuild. The .NET SDK uses this variable to help tools that run during .NET SDK commands ensure they use the same `dotnet` host configuration for any child `dotnet` processes they create for the duration of the command. Tools and any MSBuild logic that run within a build and invoke binaries via the `dotnet` host are expected to honor this environment variable to ensure a consistent experience.
187187

188-
Tools that invoke `dotnet` during an SDK command should use the following algorithm to locate it:
189-
190-
- if `DOTNET_HOST_PATH` is set, use that value directly
191-
- otherwise, rely on `dotnet` via the system's `PATH`
188+
Starting in Visual Studio 2026, MSBuild in Visual Studio _also_ ensures that `DOTNET_HOST_PATH` is set for all builds of .NET SDK projects. For greatest consistency, all MSBuild tools and logic that want to use _the same dotnet binary_ as the one that spawned the build should rely on
189+
`DOTNET_HOST_PATH` and should consider emitting a diagnostic (warning or error) when the variable is not present.
192190

193191
> [!NOTE]
194-
> `DOTNET_HOST_PATH` is not a general solution for locating the `dotnet` host. It is only intended to be used by tools that are invoked by the .NET SDK.
192+
> `DOTNET_HOST_PATH` is not a general solution for locating the `dotnet` host. It is only intended to be used by binaries and tools that are invoked by the .NET SDK or MSBuild.
195193
196194
### `DOTNET_LAUNCH_PROFILE`
197195

0 commit comments

Comments
 (0)