I have a VS2008 setup project, which creates a setup.msi which installs a WinForms application (C#).
Every time I update the version number, the users first have to uninstall the previous version before they can install the new one. Otherwise we get the dreaded “Another version of this product is already installed” message.
This is what I’m doing already when I build a new version of the installer:
- Set RemovePreviousVersions=true and DetectNewerInstalledVersion=true
- Increment AssemblyVersion (of the exe that’s being deployed)
- Increment Version (of the setup project)
- Generate a new ProductCode (as prompted by VS, when the Version is changed)
- Leave UpgradeCode unchanged
And yet it still refuses to uninstall the previous version. So, what have I missed? Or what am I doing wrong?
Thanks!
Semi-answering my own question, just for the benefit of anyone who’s interested:
Firstly, I found an incredibly useful article on how MSI updates work.
Secondly, I found InstEd, a rather nice freeware MSI editor, which showed me that there was nothing obviously wrong with my MSI file. (Yes, I could use Orca instead, if I didn’t mind downloading the whole Windows SDK to get it.)
Thirdly, and annoyingly, the original problem seems to have fixed itself and I can’t reproduce it any more. If it comes back, and if I fix it again, I’ll add a comment here!
Anyway, all this brought up a new – arguably worse – problem: the MSI now claimed to update the application but didn’t actually install anything! The solution to that is as follows:
AssemblyFileVersion absolutely
does: it must increment, if you want the new files to be installed. (This is a change in VS2008, compared to VS2005. See, for instance, this
discussion on the Microsoft
groups.)
can. Setting it to 1.9.* (or
whatever) will just result in an
error. The solution, from Stack
Overflow this time, is to set
AssemblyVersion to autoincrement, and
then open AssemblyInfo.cs and remove
the AssemblyFileVersion attribute
altogether. This will force the file
version to equal the assembly
version.