-
Notifications
You must be signed in to change notification settings - Fork 276
fix nu_msvs #1116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix nu_msvs #1116
Conversation
I'd rather not call powershell. This is what I do let vswhere = $'($env."ProgramFiles(x86)")\Microsoft Visual Studio\Installer\vswhere.exe'
let installPath = ^$vswhere -latest -property installationPath
let vsdevcmd = $'($installPath)\Common7\Tools\vsdevcmd.bat'
let op = run-external $env.comspec "/c" $vsdevcmd "-no_logo" "-startdir=none" "-arch=x64" "-host_arch=x64" "&&" "set"
$op | decode utf8 | lines | parse "{key}={value}" | where key != PWD and key != FILE_PWD and key != CURRENT_FILE | transpose -ird | load-env
$env.EXTERNAL_INCLUDE = if "EXTERNAL_INCLUDE" in $env {($env.EXTERNAL_INCLUDE | split row (char esep) | uniq)}
$env.INCLUDE = if "INCLUDE" in $env {($env.INCLUDE | split row (char esep) | uniq)}
$env.LIB = if "LIB" in $env {($env.LIB | split row (char esep) | uniq)}
$env.LIBPATH = if "LIBPATH" in $env {($env.LIBPATH | split row (char esep) | uniq)}
$env.Path = if "Path" in $env {($env.Path | split row (char esep) | uniq)}
$env.PATHEXT = if "PATHEXT" in $env {($env.PATHEXT | split row (char esep) | uniq)}
$env.PSModulePath = if "PSModulePath" in $env {($env.PSModulePath | split row (char esep) | uniq)}
$env.WindowsLibPath = if "WindowsLibPath" in $env {($env.WindowsLibPath | split row (char esep) | uniq)}
$env.__VSCMD_PREINIT_PATH = if "__VSCMD_PREINIT_PATH" in $env {($env.__VSCMD_PREINIT_PATH | split row (char esep) | uniq)} |
My guess is that it's because you're using different parameters in your PR (like $'($vswhere_cmd_ps) -prerelease -products * -format json -nocolor -utf8 -sort' in nushell, you'd have to have the * in quotes like $^vswhere_cmd -prerelease -products '*' -format json -nocolor -utf8 -sort' What happens if you just run Maybe you have an old version? Seems like 1.0.50 may be required? or maybe I need to change it like it does here? https://github.com/microsoft/vswhere/wiki/Find-VC#batch or https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-batch |
you're right, the '*' thing was the issue, i've updated the PR to remove powershell, now it only fixes the json structure |
Thanks. This is better than before. |
nu_msvs doesn't work at all on my setup, vswhere return empty string when called from nushell, the only way i made it to work is calling it from powershell
on json parsing side
installationPath is not an array, and vswhere return an array of installations is not correct
e.g