Using Visual Studio's 'cl' from a normal command line

后端 未结 7 1408
生来不讨喜
生来不讨喜 2020-11-28 21:28

Visual Studio 2003 and 2005 (and perhaps 2008 for all I know) require the command line user to run in the \'Visual Studio Command Prompt\'. When starting this command promp

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 21:42

    My version of opening the visual studio command line for Visual Studio Command Prompt in visual-studio-2010. Used internally to build a library/project and then perform some extra steps with the resulting DLL files.

    Copy these lines to your Compile and execute other steps.cmd file, or similar.

    @echo off
    
    REM Load Visual Studio's build tools
    call "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
    
    REM Choose what you want to do, 1 or 2 by (un)commenting
    
    REM     1. Add your cl.exe (or msbuild.exe or other) commands here
    REM msbuild.exe MyProject.csproj
    REM cl.exe
    REM custom-step.exe  %*
    REM pause
    
    REM     2. Open a normal interactive system command shell with all variables loaded
    %comspec% /k
    

    In this version of the script, I "stay" in interactive command line mode afterwards. Comment to REM %comspec% /k to only use the script for non-interactive purposes.

提交回复
热议问题