Repository navigation
Quote paths with spaces in MSBuild bootstrap InstallDotNetCoreTask - #7075
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes MSBuild bootstrap failures caused by invoking the dotnet-install script with unquoted paths when $(DotNetRoot) (and related paths) contain spaces, particularly on Windows agents with system-wide SDK installs under C:\Program Files\dotnet\.
Changes:
- Quote the dotnet-install script path when passed to PowerShell (
-File) and to/bin/bash. - Quote
InstallDirwhen passed to the install scripts on both Windows and Unix. - Quote the
chmodtarget path when making the script executable on non-Windows platforms.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When DotNetRoot resolves to a path with spaces (e.g. C:\Program Files\dotnet\), the dotnet-install script path and install directory are split on the space character, causing powershell.exe -File to fail with: Processing -File C:\Program failed because the file does not have a .ps1 extension. This quotes scriptPath and InstallDir in the PowerShell and bash argument strings, and also quotes the chmod argument on Unix. Same class of fix as #3737. Co-authored-by: Copilot <[email protected]>
lewing
force-pushed
the
fix/msbuild-bootstrap-path-quoting
branch
from
June 5, 2026 13:09
f69c910 to
eefaa43
Compare
JanProvaznik
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes MSBuild bootstrap
Install-scripts was not executed successfullyfailure on Windows whenDotNetRootresolves to a path with spaces (e.g.,C:\Program Files\dotnet\).Root Cause
When 1ES build agents have SDK 10.0.300 installed system-wide at
C:\Program Files\dotnet\, arcade's provisioning skips.dotnetsetup since the version is already present. This causes$(DotNetRoot)to resolve toC:\Program Files\dotnet\instead of the repo-local.dotnet\directory.InstallDotNetCoreTaskpasses the script path unquoted to PowerShell's-Fileparameter:PowerShell splits on the space and tries to interpret
C:\Programas the script file:This was confirmed by downloading the binlog from a failing PR build (build 1450966) and finding:
DotNetInstallScriptRootPath = C:\Program Files\dotnet\Processing -File 'C:\Program' failed because the file does not have a '.ps1' extension.Fix
Quote
scriptPathandInstallDirin the command argument strings for both Windows and Unix, and also quote thechmodargument.Same class of fix as #3737.
Impact
release/10.0.4xxofficial and PR builds (builds 2992647, 1450748, 1450966, 1451266)mainand other branches when their agents get updated with system-wide SDK 10.0.300This PR targets
mainso the fix backflows to all branches. Cherry-pick torelease/10.0.4xxrecommended for immediate unblock.