How to create a Batch File for Visual Studio Command Prompt

后端 未结 7 790
既然无缘
既然无缘 2020-12-02 22:29

I want to create a batch file for Visual Studio 2008 x64 Cross Tools Command Prompt to do something continuesly in my PC, here is the senario.<

相关标签:
7条回答
  • 2020-12-02 22:33

    For Visual Studio 2010, this is working great:

    call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
    
    0 讨论(0)
  • 2020-12-02 22:40

    I wrote a bat file using the following steps and it worked.

    call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
    echo call complete
    pause
    cd C:\tfs.sbdinc.com
    tf get $/MAC_MBA/CoreApplicationAndReports/Main/Application/Solution /recursive
    echo get complete
    pause
    cd C:\tfs\CoreApplicationAndReports\Main\Application\Solution
    msbuild
    echo build complete
    pause
    devenv mba.sln
    echo ide launch complete
    pause
    
    0 讨论(0)
  • 2020-12-02 22:45

    For Visual Studio 2015:

    call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
    

    For Visual Studio 2013:

    call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
    
    0 讨论(0)
  • 2020-12-02 22:48

    And for Visual Studio 2012:

    call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
    
    0 讨论(0)
  • 2020-12-02 22:52

    For Visual Studio 2019 :

    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
    
    0 讨论(0)
  • 2020-12-02 22:57

    Make the first line of your batch file set up the VS environment:

    call "C:\Program Files\Microsoft Visual Studio 2008\VC\vcvarsall.bat" x86_amd64
    svn update
    delete some files
    MSBuild MySolutiuon.sln
    ... more commands ...
    

    x86_amd64 is the argument used for x64 Cross Tools Command Prompt.

    Once vcvarsall.bat has run, msbuild will be available in the path for the rest of the commands in your batch file.

    Alternatively, if you aren't using Visual C++, you might prefer to set up the environment with this line (instead of the call to vcvarsall.bat):

    For VS 2008:

    call "%vs90comntools%vsvars32.bat"
    

    For VS 2010:

    call "%vs100comntools%vsvars32.bat"
    

    For VS 2012:

    call "%vs110comntools%vsvars32.bat"
    

    For VS 2013:

    call "%vs120comntools%vsvars32.bat"
    

    For VS 2015:

    call "%vs140comntools%vsvars32.bat"
    

    For VS 2017:

    Batch is now called vc not vs.

    call "%vs140comntools%\..\..\VC\Auxiliary\Build\vcvars32.bat"
    

    or better

    call "%vs140comntools%\VsDevCmd.bat"
    
    0 讨论(0)
提交回复
热议问题