visual-studiovisual-studio-2008visual-c++working-directorycustom-build-step

Setting working directory for custom build steps in Visual Studio 2008


Is it possible to set the working directory for a "Custom Build Step" command in a Visual Studio 2008 C++ project?


Solution

  • I don't know if you can set a default working directory but you can change it yourself in your custom build step.

    In the Property Pages dialog for the file with the custom build step, select the Command Line field and click the ... button:

    Property Pages dialog

    In the Command Line dialog, you can add multiple commands that all will be executed for the custom build. To change the working directory to C:\MyFolder and launch MyProgram.exe located in that folder, add the following lines:

    Command Line dialog

    An alternative is to define all this in a bat file such as MyCustomBuild.bat and call it in the Command Line field: call MyCustomBuild.bat