Reputation: 333
I am getting weird behavior of "Developer Command Prompt for VS 2017" command line tool. Normally in previous versions of visual studio this script (VsDevCmd.bat) was not messing current directory from where you run it. Now it seems to change it. One simple workflow would be just to start the shortcut "Developer Command Prompt for VS 2017" and it doesn't honor the "Start in" directory:
By any chance anyone seen this issue? It really bugs me because I used to have a shortcut with it and start CMD in my source directory, use TFS/msbuild commands afterwards.
Upvotes: 10
Views: 7012
Reputation: 1
If I see your quastion in right way that I'm used to work with EntityFramework Core with the help of CMD or PowerShell. For this you should right-click In the Solution Explorer panel then in the context menu, click Open Folder in File Explorer. In the address bar of the file explorer type cmd or powershell, you will start the command line from the project folder.
Upvotes: 0
Reputation: 585
vsdevcmd_end.bat, REM out the line:
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" ) )
Upvotes: 1
Reputation: 101
:: Some rocket scientist in Redmond made the VS15 VsDevCmd.bat change the cwd; the pushd/popd fixes that. 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" %*
Upvotes: 1
Reputation: 49280
You can set the VSCMD_START_DIR
environment variable to have vsdevcmd.bat
change to that directory when it finishes. Otherwise it will check if you have a %USERPROFILE%\source
directory and change to that (which is what you see).
You can change the "Target" for the "Developer Command Prompt for VS 2017" to something like the following to have change to a particular directory:
%comspec% /k "set VSCMD_START_DIR=C:\temp && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat""
Note that the path to vsdevcmd.bat
needs to be put in an additional set of double quotes.
Alternatively, rename or remove the %USERPROFILE%\source
directory (Note that this seems to be some kind of new "standard" directory for sources), that will make vsdevcmd.bat
honor the "Start In"-value (i.e. "current directory").
Upvotes: 12