Ever wanted to manually control what build-events run when you build in Visual Studio?
For example, if you want to register the output in GAC or something, but not always, only when you choose to do so.
At first I was thinking about flipping some boolean environment variable and then testing it in the build event code. But later I decided it's better to define a new build configuration and test for it. To test for the build config - use the ConfigurationName macro, like this:
if $(ConfigurationName) ==DoStuffConfig echo doing stuff
if not $(ConfigurationName) ==DoStuffConfig echo not doing stuff
Now, if you want the special code to run, switch the configuration to "DoStuffConfig" (you have to create it first, of course).If you don't want it to run, switch to some other config.
Only problem is, switching the configuration takes a while on a big solution (30 seconds or so). Is there a better way?
Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co