Do NOT save the same PackageCode .
Do you really want this automatically generated ... refer to the documentation:
Non-identical .msi files should not have the same package code. it is important to change the package code because it is the primary identifier used by the installer to search and verify the package is correct for this installation. If a package is modified without changing the code package, the installer cannot use the newer package if both are available to the installer.
Here is an example from our production environment ...
<Product Id="*" UpgradeCode="$(var.Property_UpgradeCode)" Name="!(loc.ApplicationName)" Language="!(loc.Property_ProductLanguage)" Version="$(var.version)" Manufacturer="!(loc.ManufacturerName)" > <Package Description="!(loc.Package_Description) $(var.version)" Comments="!(loc.Package_Comments)" Manufacturer="!(loc.ManufacturerName)" InstallerVersion="301" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" Platform="$(var.ProcessorArchitecture)" />
The current drawback of this approach is that you probably also want to provide major updates that only the update code refers to. Now we can take advantage of the fact that for the Windows Installer packages, only the first three fields are important, for example. 1.0.0.1 and 1.0.0.2 are both interpreted as 1.0.0 (this is explicitly mentioned in the documentation, so we can rely on it.)
Expanding this logic, we can automatically increase the (ignored) fourth version field with each assembly, but prevent updating when the first three match.
<UpgradeVersion Property="ANOTHERBUILDINSTALLED" Maximum="$(var.version)" Minimum="$(var.version)" IncludeMinimum="yes" IncludeMaximum="yes" OnlyDetect="yes" />
The growth potential is completely transparent to customers, but it does not allow internal testing / QA teams to install one “build” on top of another, and you also need to ensure that immediately after any public release you manually increase one of the first three versions.
source share