Posted on August 13, 2008 in C#, Programming by admin

In C++ projects using Visual Studio 2005, it was common to perform a different “Post-Build step” in Debug and Release (for example, copy final files to a release folder, launch an installer…).

In C# projects, Microsoft decided to remove these “per-configuration” build events. The “Event” script must be the same for every configuration. A workaround for this is tu use batch file functions top differentiate targets:

REM Here, do things for both configurations

IF NOT "$(ConfigurationName)"=="Debug" Goto :NotDebug
REM Here, do things only for debug

:NotDebug
IF NOT "$(ConfigurationName)"=="Release" Goto :NotRelease
REM Here, do things only for debug
:NotRelease

That’s as simple !

blog comments powered by Disqus