Saturday, 15 May 2010

Conditional buidl Events using Viusal Studio 2008

Sometimes you need some extra actions to be trigged after build, eg. copy exe files. To add an extra action, go to project properties and select “Build Events” tab. You can add the additional actions before and after build process.

But what if some conditions are needed to check before performing your action. !

Two things you have to investe in order to know how to make conditional build event in VS2008, first, is the command macros introduced by Microsoft in VS2008, second, is the batch file ".BAT" commands.

Command Macros are
BAT Commands are


IF NOT $(ConfigurationName) == Release GOTO end
Copy "$(SolutionDir)\$(ConfigurationName).exe" "$(TargetPath)"

No comments:

Post a Comment