Visual Studio - Run Batch File

后端 未结 5 2270
别跟我提以往
别跟我提以往 2021-02-07 08:04

What I would like

I would like to easily run a batch file without leaving Visual Studio. The batch files are not always the same, they change depending on the solutio

5条回答
  •  太阳男子
    2021-02-07 08:36

    You can add a new Makefile project to your solution. A Makefile project is a simple Visual Studio project whose build action is any command line you want. It is listed under the Visual C++ - General category in the new project dialog. In your case, just set the build command to invoke your batch script. Then, to execute your script while working in your solution, just right click on the Makefile project in the Solution Explorer and choose the Build context menu item.

    Since you intend to run this script run on-demand (as opposed to running each time you build) you will want to remove it from the build in the Configuration Manager. Don't forget to disable building the project for all platforms and configurations.

    Most of the macros are available to the Makefile project's build command line, although perhaps some that are associated with your main project will not have the correct value.

提交回复
热议问题