"Remove previous versions" behavior in VS2008 .msi builder

I noticed when creating some .MSIs lately in VS2008 that the old versions of my binaries were not getting removed, even though I set RemovePreviousVersion=true (just like I always had) in the .MSI project.

After looking around a bit, several people have hit this problem, and some MVP named Phil Wilson is going around telling everyone[1] that this behavior actually changed from VS2005 to VS2008, and unless you bump the “version numbers” on each of your files, they won’t be replaced in an .MSI upgrade.

Has anyone hit this problem? Or is there a way to just PUT IT BACK THE WAY IT WAS??

[1]

http://www.eggheadcafe.com/software/aspnet/32799516/visual-studio-2008-setup.aspx
http://www.techtalkz.com/windows-installer-msi/469875-file-not-getting-updated-during-upgrade-msi.html
…and so on.

This is a nasty one and it does not surprise me to see others are getting tripped up by it. Typically when installing a new version you want this to happen:

  1. the existing version uninstalls
  2. the new version installs

And that’s the way it has worked for years and years. VS2008 decided to “optimize out” step #1. I have no idea why such a catastrophic change was made and am appalled no warning is given by VS2008 when upgrading project files about this. You can not work around this with the VS2008 IDE, but you can use orca or something of that nature to post process the msi. In the InstallExecuteSequence table, change the RemoveExistingProducts Sequence to 1525. Now your old version will uninstall before being obliterated by the new version.

Steer clear of Phil’s work around, it just opens up a pandora’s box creating many new and hard to solve problems that require finding KB articles, hand editing MSI files, creating complex actions every time you need to hit the build button, dealing with file types without version numbers attached, and so on and so forth.

Eriksson wrote:

You can not work around this with the VS2008 IDE, but you can use orca
or something of that nature to post process the msi. In the
InstallExecuteSequence table, change the RemoveExistingProducts
Sequence to 1525. Now your old version will uninstall before being
obliterated by the new version.

Thanks, I’m going to try it. P.S. I love how the solution to these sorts of problems is to use Orca to insert some magic number into the .MSI somewhere. We had to do something similar to preinstall drivers on Vista, i.e. to automatically elevate privileges and invoke the UAC screen, the details escape me at this time however.

Eriksson wrote:

In the InstallExecuteSequence table, change the RemoveExistingProducts
Sequence to 1525.

Thanks for the tip … it works. To automatically do it, I generated a small MakeMSI file that goes in and changes this automatically, and then I invoke MakeMSI as a post-build event from my MSI project. So, back to normal, too bad I wasted all morning doing it.