Visual Studio 2017 Developer Command Prompt switches the current directory

I get the strange behavior of the "Command Prompt for VS 2017" command line tool. Usually in previous versions of the visual studio, this script (VsDevCmd.bat) did not start the current directory from which you ran it. Now that seems to have changed. One simple workflow was to simply launch the "Developer Command Line for VS 2017" shortcut, and it does not respect the "Start at" directory: enter image description here

Has anyone seen this problem? It really hurts me because I used a shortcut with it and ran CMD in my source directory, then use the TFS / msbuild commands.

+4
source share
3 answers

VSCMD_START_DIR vsdevcmd.bat , . , %USERPROFILE%\source ( , ).

"" " VS 2017" , :

%comspec% /k "set VSCMD_START_DIR=C:\temp && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat""

, vsdevcmd.bat .

%USERPROFILE%\source ( , , , - "" ), vsdevcmd.bat "Start In" (.. ").

+6

vsdevcmd_end.bat, :

    cd /d "%USERPROFILE%\Source"
   @REM Set the current directory that users will be set after the script completes
   @REM in the following order:
   @REM 1. [VSCMD_START_DIR] will be used if specified in the user environment
   @REM 2. [USERPROFILE]\source if it exists
   @REM 3. current directory
   if "%VSCMD_START_DIR%" NEQ "" (
       cd /d "%VSCMD_START_DIR%"
   ) else (
       if EXIST "%USERPROFILE%\Source" (
           cd /d "%USERPROFILE%\Source"
       )
   )   
+1

:: Some rocket scientists in Redmond made the VS15 VsDevCmd.bat a replacement for cwd; pushd / popd fixes this. pushd% CD% call "C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Professional \ Common7 \ Tools \ VsDevCmd.bat" POPD

"C: \ Program Files (x86) \ CruiseControl.NET \ server \ ccnet.exe"% *

0
source

Source: https://habr.com/ru/post/1687281/


All Articles