Skip to content

Commit

Permalink
Allow tools\razzle & nuget restore to work with NuGet 5 and later (#…
Browse files Browse the repository at this point in the history
…1046)

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
NuGet/NuGet.Client@21f2b07
(NuGet/NuGet.Client#2687 ).

Unfortunately, in PR
#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> 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`).
  • Loading branch information
metathinker authored and DHowett committed May 29, 2019
1 parent 8baba4b commit 2f88c46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/razzle.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if not defined MSBUILD (
goto :EXIT
)

set PATH=%PATH%"%MSBUILD%\..";
set PATH=%PATH%%MSBUILD%\..;

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set ARCH=x64
Expand Down

0 comments on commit 2f88c46

Please sign in to comment.