I have a VS Setup (.vdproj) installer project. I've just changed the version from 1.0.0 to 1.0.1 and rebuilt, but when I run the installer MSI I get this error:
I am expecting the installer would allow overwriting the previous version, are there some other settings I must change or is there some other problem that might cause this behaviour?
What you most likely need to do when changing the version number of an installer project's target is to also change that installer's "ProductCode" property (this will be a GUID, of the form {A327EF4E-8B37-A0CC-B678-4AAD2D219E36}
).
Generally, when you finish editing the "Version" property (in the "Properties" pane), Visual Studio will show you a pop-up like the following:
You should click the "Yes" button in order to generate a new GUID, which will enable the MSI file to recognize that it is updating an existing installation with a newer version. Otherwise, the installer will detect a 'clash' between the two versions of the 'same' product and show the error that you reported.
Note that the installer uses the "UpgradeCode" property (also a GUID) to detect that your product is actually a later version of the same application (even though the "ProductCode" is different) and it will replace any existing installed files with the updated versions in the newer package. Be sure to keep this the same across all versions of your program. (In fact, I keep a copy of this GUID in a comment in one of my project's source files, just in case of any inadvertent change.) This is the "tool-tip" help text shown when you select "UpgradeCode" in the Properties pane:
Specifies a shared identifier that represents multiple versions of an application
Also note that any component files (executables, DLLs, et cetera) should have any embedded VERSIONINFO
resources suitably updated, or any existing files from the previous installation will not be replaced. (For files without a VERSIONINFO
resource, then I believe that their modification dates are used to determine whether or not to update/replace.)