How do I call Visual Studio 2017 RC's version of MSBuild from a BAT file?

后端 未结 9 863
暖寄归人
暖寄归人 2020-12-04 19:19

Earlier versions of MSBuild could be found here: %programfiles(x86)%\\msbuild\\\\bin\\msbuild.exe.

But for Visual Studio 2017RC the path

9条回答
  •  佛祖请我去吃肉
    2020-12-04 19:46

    Now that VS 2017 has been released, thought it might be useful to add my 2 cents:

    Creating a batch file:

    Open Notepad

    Copy the following and paste into notepad, replacing the solution you want to build with [My Solution Name Here]:

    @echo off
    
    :variables
    SET msBuildLocation="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
    SET solutionDirectory=[My Solution Location Here]
    SET batchFileLocation=[BatchFileLocation Here]
    
    cd %solutionDirectory%
    
    echo Building MS files for [My Solution Name Here].
    
    call %msBuildLocation% [My Solution Name].sln /p:Configuration=Debug /m:4 /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false  /consoleloggerparameters:Summary;ShowTimestamp;ShowEventId;PerformanceSummary
    echo -
    echo --------Done building [My solution name here].--------------
    echo -
    
    cd %batchFileLocation%
    

    Save your batch file as whatever you want with the .bat extension. Be sure to select all files instead of .txt or else it won't work. Call the batch file by issuing the cd command where you have it saved at, and it should work. Or, just double-click. Done.

    Please note that my version of visual studio is community; you'll need to replace the path with the appropriate version.

提交回复
热议问题