Open Visual Studio from within Git bash

Solution 1:

It works for me, when I put single quotes around the path and use git path syntax. I just dragged devenv into the console to get the path and hit enter.

'/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/devenv.exe'

git bash launching devenv.exe

Solution 2:

I added an alias to my ~/.profile file:

alias studio='"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/devenv.exe"'

So I can easily open any solution from the shell:

$ studio MySolution.sln &

The & at the end sends the Visual Studio process to background so that the shell does not get blocked by Visual Studio and Visual Studio won't be ended when I close the shell window.