Friday, 28 October 2011

Visual Studio - Batch Build

In Visual Studio, there are different Configurations for development.
The most common are:

  • Debug
  • Release
The main difference, out of the box, is that the Release configuration doesn't include debug information (.PDB file), and also optimises code on compilation.

As a developer, this can be extended, so that different pre- and post- build events can be hooked up when in Debug than to release...

For example, when developing .NET services, my Debug configuration will stop the service, uninstall it, compile the project, then reinstall the service and start it up....
I also us the #IF DEBUG compiler directive to launch a debugger (VS 2008) when you run it in Debug mode.

My release profiles are always *clean* and don't include a lot of redundant steps I use in development.



Have you ever been in a situation where you have just finished development and Alpha testing, and then gone to release to the client, only to discover that you haven't build the Release version, and have given them an old copy of Release?


Happens to me every now and again when I am in a rush to release, so I thought I'd share my little nugget of wisdom with you all...


In VS 2008, on the build menu, there is an option to "Batch Build".  This will bring up a dialog that will allow you to specify which projects form your solution, and which *configurations* you want to compile!


I have hooked this up to a shortcut key, so I can quickly build *everything*:




This way, every time I build, I get both the Debug and Release builds going...


If you have any funky #IF DEBUG...  compiler directives, it may affect the build results, so watch those, but apart form that, you can be confident that all binaries, whether in Debug or Release, are current...


Have fun now kids....

No comments:

Post a Comment