Saturday, August 20, 2011

VS 2010 Setup Project - how to upgrade?


Setup projects under VS2005 and VS2008 were easy to upgrade:
  1. select the Setup project
  2. go to the Properties tab
  3. update the Setup project Version
  4. accept VS suggestion to change the Product Code
  5. build the Setup project
This isn't enough under VS2010.
Is it a bug? In fact no. It happens that VS2010 uses the installer in a smarter way. The MSI generated by VS2010 only replaces changed assemblies. The same principle is used by ClickOnce and it makes upgrades faster.

The question is: what is a changed assembly? Different update date? Different size? Not at all. Assemblies are different when they have a different File Version. As simple as that.
I'm not sure ClickOnce uses this criteria to identify different assemblies.

Upgrading a Setup project under VS2010 is a bit more complicated:
  1. update the File Version of all assemblies that are changed for this upgrade
  2. generate new binaries for these assemblies
  3. select the Setup project
  4. go to the Properties tab
  5. update the Setup project Version
  6. accept VS suggestion to change the Product Code
  7. build the Setup project
To know more about this subject and understand why you need to do it this way under VS2010, you can read an interesting discussion.

So what about the SolutionInfo and the Consistent Version Numbers Across All Assemblies technique? It's a way to make sure you don't forget to update the File Version of all assemblies, even if they didn't change. It's a kind'a "fail safe" upgrade. Of course you risk to replace too many assemblies that in fact didn't need to be replaced. The choice is yours.