How to run bash from arbitrary build tasks in Visual Studio 2017 (directory-based project)? -
i'm trying enable custom build tasks use bash build docbook-based documentation in visual studio 2017. use built-in windows subsystem linux in windows 10. can launch cmd.exe , run dir in ms's examples. however, need run make args in bash , that's fails with:
'"bash"' not recognized internal or external command, operable program or batch file. i can run cmd.exe interactively , start bash without problems. fails in visual studio. vs2017 use special environment? how make run bash via tasks? guess missing simple , trivial, don't understand at.
essentially, want run make all-html command against path docbook sources.
here minimal task example:
{ "version": "0.2.1", "tasks": [ { "taskname": "build all-html", "appliesto": "*", "type": "command", "command": "bash" } ] }
the reason command doesn't naturally find bash expect because visual studio 32-bit program. means won't use 64-bit cmd.exe when specify commands.
you can reproduce visual studio doing opening 32-bit command window c:\windows\syswow64\cmd.exe , trying bash command there.
the solution invoke bash.exe directly via c:\windows\sysnative virtual folder.
you can find discussion/explanation of sysnative folder , why necessary here in official bash on windows github.
here example command should work you:
{ "taskname": "print-pwd", "appliesto": "*", "type": "command", "command": "%windir%\\sysnative\\bash.exe", "args": [ "-c", "pwd" ] }
Comments
Post a Comment