How to configure post-build events for setup/deployment projects in Visual Studio 2005

While researching a previous blog post, I discovered a way to configure post-build events for setup/deployment projects in Visual Studio 2005. I had not realized that previous versions of Visual Studio did not support configurable post-build events for setup projects, but Visual Studio 2005 does. In addition, the way to access the UI needed to configure this setting for a setup project is different than for other project types in the Visual Studio 2005 IDE.

The following steps can be used to add a post-build step to your setup/deployment project:

  1. Open or create a setup/deployment project in Visual Studio 2005
  2. Press F4 to display the Properties window
  3. Click on the name of your setup/deployment project in the Solution Explorer
  4. Click on the PostBuildEvent item in the Properties window to cause a button labeled "..." to appear
  5. Click on the "..." button to display the Post-build Event Command Line dialog
  6. Add a command line of your choice in the Post-build event command line text box
  7. Build your project in Visual Studio and verify that the post-build event is executed after the main MSI build

You can also configure a pre-build event in a similar manner - there is also an item in the Properties window named PreBuildEvent.

As I described in this previous blog post, it can be useful to run a script as a post-build event if you want to automatically modify the MSI that is built as a part of your project to include settings that are not available as part of the setup/deployment project options in the Visual Studio IDE UI.