madskristensen / OpenCommandLine

A Visual Studio extension
http://vsixgallery.com/extension/f4ab1e64-5d35-4f06-bad9-bf414f4b3bbb/
Other
160 stars 47 forks source link

"Open files at project level" not respected in VS2017 #52

Open janv8000 opened 7 years ago

janv8000 commented 7 years ago

Hello,

When using the "Dev Cmd Prompt" preset the working directory is not correctly set.

Current behaviour: opens in C:\Users\<username>\Source Expected behaviour: opens in C:\<SomeFolder>\<SomeSolutionDirectory>\<SomeProjectDirectory

VsDevCmd.bat changes the current working directory causing path resolution to fail in existing scripts mentions the following:

This was a design change that was made for the developer command prompt scripts for Visual Studio 2017. However, there is an "escape hatch" available to ensure the command prompt ends up in a known directory.

They also provide a workaround:

@REM set the directory to the current directory (or directory of your choice)
set "VSCMD_START_DIR=%CD%"
"call <vsinstance_path>\Common7\Tools\VsDevCmd.bat"

Temporary workaround: Set command arguments to /k "set "VSCMD_START_DIR=%CD%" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\..\Tools\VsDevCmd.bat""

image