Powershell script to auto increment a Visual Studio (2005) Setup project

Visual Studio 2005 has a handy Setup type of project (.vdproj), which can create basic installers.

The VS setup project is particularly useful if you want to make a ClickOnce installer.

note: if you are also using obfuscation - then you can use the ClickOnce product:

http://www.clickoncemore.net


However, the VS setup project has a default behaviour, where:

it will refuse to install over an existing install, unless:


  • the setup version is higher
  • the product version is higher

AND

  • the product GUID is different


I think this is to protect application data: for example if your application would have a local database that could be destroyed on un-install.

Note: on a developer machine, you can work around this behaviour, by installing from within Visual Studio itself (by right-clicking on the Setup project, and selecting Install).

The link below is to a Powershell script which updates a given Setup project,
so that the 3 attributes above are updated.  It has been used with Visual Studio 2005.

http://www.natureireland.com/blogs/antipatterns/attachments/incrementSetupProject.ps1.txt

This allows you to auto-build a VS 2005 Setup project which will always be able to correctly install.

Comments