Search code examples
cmdbuildvisual-studio-2017devenv

VS2017 command line build issue


I have installed both VS2008 and VS2017 on same machine. During test I found that if I set VS2018 build environment firstly by command: %VS90COMNTOOLS%vsvars32.bat, then reset to VS2017 environment by command: %VS150COMNTOOLS%VsDevCmd.bat. The reset will report following error:

[ERROR:team_explorer.bat] Directory not found: "C"\Program Files(x86)\Microsoft Visual Studio 9.0\Common7\IDECommonExtensions\Microsoft\TeamFoundation\Team Explorer" [Error:VSDevCmd.bat] * VsDevCmd.bat encounterred errors. Environment may be incomplete and/or incorrect. *

If I just set VS2017 build environment by %VS150COMNTOOLS%VsDevCmd.bat. No error occurs. Does anyone meet this issue?


Solution

  • I found a workaround...Use SetLocal and EndLocal to set local build environment.

    SetLocal
    Call %VS90COMNTOOLS%vsvars32.bat
    EndLocal
    call %VS150COMNTOOLS%VsDevCmd.bat
    

    Save above command to a bat file and call it. The error disappeared.