Wednesday, 7 May 2014

Custom Build Tools in Visual Studio

Custom Build Tools in Visual Studio

You can compile non-standard file types with arbitrary programs in Visual studio by specifying a Custom Build Tool. But often the tool expects to be running in the same directory as the target file, and it won't be, it will be running in the Project directory. And multiline batch commands are not allowed in Visual Studio 2012.

So we use the START batch command to specify the directory with /D, followed by the exe and its parameters:

START "title" /D"%(RootDir)%(Directory)" "win_flex.exe" "%(FullPath)"