Visual Studio コマンドプロンプト用のバッチファイルを作成する方法 質問する

Visual Studio コマンドプロンプト用のバッチファイルを作成する方法 質問する

バッチファイルを作成したいVisual Studio 2008 x64 Cross Tools Command Prompt私の PC で継続的に何かを実行するには、次のシナリオを実行します。

svn update
delete some files
MSBuild MySolutiuon.sln
delete some files
xcopy somefiles
MSBuild AutomateBuildConfiguration.xml /p:Configuration=Release
xcopy some files
delete somefiles
xcopy some files

create a Zip file if it is possible // it is not neccessary

ほとんどの操作は、単純なコマンド プロンプトとMSBuild partsVisual Studio コマンド プロンプトで実行できますが、これら 2 つのプロンプトが異なるため、シナリオを完了できません。

すべてのコマンドをテストしましたが、うまく動作しました。何をすべきかご存知の場合は解決策を教えてください。

私がチェックしましたこれ何も理解していませんでした よろしくお願いします

ベストアンサー1

バッチ ファイルの最初の行で VS 環境を設定します。

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

x86_amd64x64 クロス ツール コマンド プロンプトで使用される引数です。

vcvarsall.bat が実行されると、バッチ ファイル内の残りのコマンドのパスで msbuild が使用できるようになります。

あるいは、Visual C++ を使用していない場合は、(vcvarsall.bat を呼び出す代わりに) 次の行を使用して環境を設定することをお勧めします。

VS 2008 の場合:

call "%vs90comntools%vsvars32.bat"

VS 2010 の場合:

call "%vs100comntools%vsvars32.bat"

VS 2012 の場合:

call "%vs110comntools%vsvars32.bat"

VS 2013 の場合:

call "%vs120comntools%vsvars32.bat"

VS 2015 の場合:

call "%vs140comntools%vsvars32.bat"

VS 2017 の場合:

バッチは現在vcnotと呼ばれていますvs

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

またはそれ以上

call "%vs140comntools%\VsDevCmd.bat"

おすすめ記事