[PR #1046] [MERGED] Fix #1045 - Allow tools\razzle & nuget restore to work with NuGet 5 and later #24447

Open
opened 2026-01-31 09:03:23 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/1046
Author: @metathinker
Created: 5/29/2019
Status: Merged
Merged: 5/29/2019
Merged by: @DHowett-MSFT

Base: masterHead: nuget-5-illegal-characters-in-path


📝 Commits (1)

  • ed55ff7 Allow tools\razzle & nuget restore to work with NuGet 5 and later

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 tools/razzle.cmd (+1 -1)

📄 Description

This PR fixes issue #1045, in which if you had NuGet 5 on your PATH prior to running tools\razzle.cmd, then tools\razzle.cmd & nuget restore would fail with an "Illegal characters on path" error in NuGet.

Detailed description of the pull request

Since version 5.0.2, NuGet has used the PATH environment variable to find MSBuild.exe before looking in other file paths. See NuGet change 21f2b07f2c (https://github.com/NuGet/NuGet.Client/pull/2687 ).

Unfortunately, in PR https://github.com/microsoft/terminal/pull/606 , tools\razzle.cmd was changed to add the MSBuild.exe folder path in quotes to the PATH environment variable. Windows itself is fine with this (you can type msbuild and MSBuild runs), but some tools are not, including NuGet itself, so you would get errors like this:

D:\GitHub\metathinker\console> path
PATH=[snip snip];"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe\..";

D:\GitHub\metathinker\console> where nuget
C:\ProgramData\chocolatey\bin\nuget.exe
D:\GitHub\metathinker\console\dep\nuget\nuget.exe

D:\GitHub\metathinker\console> nuget restore OpenConsole.sln
Illegal characters in path.

razzle.cmd runs NuGet itself, but does so before adding the MSBuild folder to the PATH, so it was not affected by this problem.

This change fixes the issue by dequotifying the PATH, so that if you already had a newer version of NuGet on your PATH before running tools\razzle.cmd, that version will continue to work should you need to run nuget restore again (such as after a git clean -dx).

PR checklist

References

Nothing else relevant.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/1046 **Author:** [@metathinker](https://github.com/metathinker) **Created:** 5/29/2019 **Status:** ✅ Merged **Merged:** 5/29/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `nuget-5-illegal-characters-in-path` --- ### 📝 Commits (1) - [`ed55ff7`](https://github.com/microsoft/terminal/commit/ed55ff7d24102903313333fe36ab2dd2ca1bf468) Allow `tools\razzle & nuget restore` to work with NuGet 5 and later ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tools/razzle.cmd` (+1 -1) </details> ### 📄 Description This PR fixes issue #1045, in which if you had NuGet 5 on your PATH prior to running `tools\razzle.cmd`, then `tools\razzle.cmd & nuget restore` would fail with an "Illegal characters on path" error in NuGet. ## Detailed description of the pull request Since version 5.0.2, NuGet has used the PATH environment variable to find MSBuild.exe before looking in other file paths. See NuGet change https://github.com/NuGet/NuGet.Client/commit/21f2b07f2c2e84afd6602c6743d356dae8880c0c (https://github.com/NuGet/NuGet.Client/pull/2687 ). Unfortunately, in PR https://github.com/microsoft/terminal/pull/606 , `tools\razzle.cmd` was changed to add the MSBuild.exe folder path in _quotes_ to the PATH environment variable. Windows itself is fine with this (you can type `msbuild` and MSBuild runs), but some tools are not, including NuGet itself, so you would get errors like this: ``` D:\GitHub\metathinker\console> path PATH=[snip snip];"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe\.."; D:\GitHub\metathinker\console> where nuget C:\ProgramData\chocolatey\bin\nuget.exe D:\GitHub\metathinker\console\dep\nuget\nuget.exe D:\GitHub\metathinker\console> nuget restore OpenConsole.sln Illegal characters in path. ``` `razzle.cmd` runs NuGet itself, but does so before adding the MSBuild folder to the PATH, so it was not affected by this problem. This change fixes the issue by dequotifying the PATH, so that if you already had a newer version of NuGet on your PATH before running `tools\razzle.cmd`, that version will continue to work should you need to run `nuget restore` again (such as after a `git clean -dx`). ## PR checklist * [x] Closes #1045 * [x] CLA signed - I'm a Microsoft employee so I don't need to sign * [ ] Tests added/passed - not sure any tests are applicable? * [x] Requires documentation to be updated - N/A; documentation doesn't need updating * [ ] I've discussed this with core contributors already ## References Nothing else relevant. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:03:23 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24447