Skip to content

Flow DotNetPath through to dotnet-install scripts - #17097

Merged
ViktorHofer merged 1 commit into
dotnet:mainfrom
ViktorHofer:viktorhofer/installdotnetcore-dotnetpath
Jul 10, 2026
Merged

ViktorHofer merged 1 commit into
dotnet:mainfrom
ViktorHofer:viktorhofer/installdotnetcore-dotnetpath

Conversation

@ViktorHofer

Copy link
Copy Markdown
Member

The InstallDotNetCore MSBuild task accepts a DotNetPath parameter, but only used it for the local already installed check. The dotnet-install.ps1/.sh scripts recomputed the install root themselves from DOTNET_GLOBAL_INSTALL_DIR / .dotnet, so the task's resolved path never flowed to the actual install invocation.

This change:

  • Exposes a -dotnetPath parameter in both eng/common/dotnet-install.ps1 and eng/common/dotnet-install.sh. When set, it takes precedence over the env-var / .dotnet fallback when computing the install root (fallbacks preserved for direct script invocations).
  • Passes the task's DotNetPath through via -dotnetPath in InstallDotNetCore.cs.

Both scripts still append the architecture subfolder afterward, consistent with the task's CheckRuntimeDotnetInstalled logic.

The InstallDotNetCore task resolves a DotNetPath but only used it for the
local 'already installed' check. The dotnet-install.ps1/.sh scripts
recomputed the install root themselves. Expose a -dotnetPath parameter in
both scripts and pass the task's resolved DotNetPath through so the
install location is consistent.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 3875be5f-869d-42d5-a70f-df6757114b05
Copilot AI review requested due to automatic review settings July 10, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures the InstallDotNetCore MSBuild task’s resolved DotNetPath (install root) is actually honored by the dotnet-install wrapper scripts, instead of those scripts independently recomputing the root from DOTNET_GLOBAL_INSTALL_DIR / $(RepoRoot).dotnet.

Changes:

  • Adds a -dotnetPath parameter to eng/common/dotnet-install.ps1 and eng/common/dotnet-install.sh and makes it take precedence when selecting the install root.
  • Updates InstallDotNetCore.cs to pass the task’s DotNetPath through to the install scripts via -dotnetPath.
  • Preserves existing fallback behavior for direct script invocations (env-var / .dotnet) when -dotnetPath isn’t provided.
Show a summary per file
File Description
src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs Passes the task’s resolved install root through to the dotnet-install script invocation.
eng/common/dotnet-install.sh Accepts -dotnetPath and uses it as the install root before falling back to existing defaults.
eng/common/dotnet-install.ps1 Accepts -dotnetPath and uses it as the install root before falling back to existing defaults.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

@ViktorHofer
ViktorHofer enabled auto-merge (squash) July 10, 2026 15:52
@ViktorHofer
ViktorHofer merged commit 21f10e1 into dotnet:main Jul 10, 2026
9 of 10 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants