Skip to content

Fix dotnet.exe path quoting in wix.targets#16381

Merged
lewing merged 1 commit intomainfrom
fix-dotnet-tool-path-quoting
Dec 8, 2025
Merged

Fix dotnet.exe path quoting in wix.targets#16381
lewing merged 1 commit intomainfrom
fix-dotnet-tool-path-quoting

Conversation

@lewing
Copy link
Member

@lewing lewing commented Dec 8, 2025

Fixes an issue where the Exec command in GenerateVSInsertionNupkgCore target was not quoting the DotNetTool variable, causing build failures when dotnet.exe is installed in a path with spaces. Added proper quoting around the DotNetTool variable in the Exec command.

The Exec command in GenerateVSInsertionNupkgCore target was not quoting the DotNetTool variable, causing failures when dotnet.exe is installed in a path with spaces (e.g., 'C:\Program Files\dotnet\dotnet.exe'). This resulted in the error: 'C:\Program' is not recognized as an internal or external command. Added proper quoting around the DotNetTool variable to fix the issue.
Copy link

Copilot AI left a comment

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 fixes a build failure in the WiX 5 installer build targets that occurred when the .NET SDK (dotnet.exe) is installed in a path containing spaces. The fix adds proper quoting around the $(DotNetTool) variable in the Exec command within the GenerateVSInsertionNupkgCore target.

Key Changes:

  • Added quotes around $(DotNetTool) variable in the Exec command to handle paths with spaces (e.g., "C:\Program Files\dotnet\dotnet.exe")

@lewing lewing merged commit 7438a99 into main Dec 8, 2025
15 checks passed
@lewing lewing deleted the fix-dotnet-tool-path-quoting branch December 8, 2025 17:43
@ericstj
Copy link
Member

ericstj commented Dec 8, 2025

Looked for other instances -- https://github.com/search?q=repo%3Adotnet%2Farcade+%2FCommand.*%5C%24%5C%28DotNetTool%5C%29%2F+language%3AXML&type=code

Seems Wix is the only case. There is one that wasn't fixed in this PR, but might be in dead code as it's for old wix

@ericstj
Copy link
Member

ericstj commented Dec 8, 2025

lewing added a commit to dotnet/dotnet that referenced this pull request Dec 8, 2025
Fixes an issue where Exec commands were not quoting the DotNetTool variable, causing build failures when dotnet.exe is installed in a path with spaces (e.g., 'C:\Program Files\dotnet\dotnet.exe').

This applies the same fix from dotnet/arcade#16381 to all occurrences in the dotnet/dotnet repository.

Changed Command="$(DotNetTool) ..." to Command=""$(DotNetTool)" ..." in:

- src/diagnostics/src/SOS/SOS.Package/SOS.Package.csproj

- src/runtime/src/mono/sample/Android/AndroidSampleApp.csproj

- src/sdk/src/Layout/redist/targets/OverlaySdkOnLKG.targets

- src/arcade wix/wix.targets and wix5/wix.targets

- repo-projects/Directory.Build.targets

- 8 files in src/source-build-reference-packages/src/externalPackages/projects/
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