Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate razzle to use vswhere (#13) #606
Conversation
msftclas
commented
May 9, 2019
•
|
I can't figure out where in the nuget docs it specifies that |
| ) | ||
|
|
||
| rem Add path to MSBuild Binaries | ||
| for /f "usebackq tokens=*" %%i in (`%VSWHERE% -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do set MSBUILD=%%i |
This comment has been minimized.
This comment has been minimized.
heaths
May 9, 2019
Member
You should add -products * if you want to also support Visual Studio Build Tools. By default, vswhere only supports finding Community, Professional, and Enterprise - our traditional VS SKUs.
|
Couple questions, but I'm not gonna block this over them |
I can tackle these after work today, or on another PR later if you want this in sooner. |
|
@amweiss I'm in no rush - my unread inbox is expanding at just about the rate I reply to things :P |
|
Ha, I expected it would be worse than that by now |
|
/azp run |
azure-pipelines
bot
commented
May 10, 2019
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
* Update razzle to use vswhere * Make vswhere pickup build tools * Make razzle handle errors better * Make bcz handle MSBUILD with spaces * Update readmes to use bcz and fix typo
|
|
||
| rem Find vswhere | ||
| rem from https://github.com/microsoft/vs-setup-samples/blob/master/tools/vswhere.cmd | ||
| for /f "usebackq delims=" %%I in (`dir /b /aD /o-N /s "%~dp0..\packages\vswhere*" 2^>nul`) do ( |
This comment has been minimized.
This comment has been minimized.
Daniel15
May 18, 2019
Is there a reason this needs to be a batch file rather than using PowerShell? I imagine this could be clearer than the obscure dir command if it used PowerShell.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
zadjii-msft
May 20, 2019
Member
Because not everyone likes Powershell. Our dev team is split between users of Powershell and cmd, so we have scripts for both.
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 microsoft#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`).
…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`).


amweiss commentedMay 9, 2019
•
edited
Instead of listing out all the locations for MSBuild, use the vswhere tool to find the location and add that directory to that path.