Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

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

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

  • Comments 7

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.

 

  • How to configure post-build events for setup/deployment projects in Visual Studio 2005 Aaron Stebner's
  • Thank you so very much for pointing the way to something that seems so simple, but, since it deviates from the norm, is not intuitive at all. I don't know how many times I have worked on the properties window and never saw these "special" properties. This blog is almost a year old, but still relevant!

  • Hello,

    We've just run into a very strange behavior associated with post-build events.  Everything was working fine.  However in the last couple days the post-build event started firing pre-build.  Has anyone else seen this behavior?

    We're in the middle of investigation and one things we are looking at are recently applied security kb's

    kb937060

    kb925674

  • Hi Samjac - I'm sorry, but I've never heard of an issue like this.  I'd suggest searching for related bugs on the Visual Studio bug reporting site (http://connect.microsoft.com/visualstudio/) and reporting a new bug if you don't find one.

    It might also help to search for help on the Setup and Deployment Projects forum at http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=6&SiteID=1.

    I'm sorry I'm not able to be more helpful in this scenario.

  • Thanks! It helps me out!

  • Thank you! Something about the wording made it obvious that I could use multiple DOS commands, one per line, to copy multiple files. I would have spent hours and likely never hit upon something so blatantly obvious.

Page 1 of 1 (7 items)
Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post