简体   繁体   中英

How to avoid multiple installation/repair of same product using MSI Installer

I want to make an MSI installer for my application and I also need to remotely deploy this application via active directory software deployment. I also need to make sure that this application is not installed multiple times and should not allow any repair or modification. To ensure this thing I have made ARPNOREPAIR=1 in my installer. This works fine if I try to install multiple instances manually or even silently. But I am facing problem when I am doing it using active directory. It always allow multiple installation which leads to a corrupt installation state. I want to is there any way I can make sure that multiple instances of the applications are not installed even if the versions are different.

Thanks

The easiest way to block all versions of a .msi package from being installed is to use the information provided by the UpgradeCode . You can find out if other versions of the related packages by adding the following (using WiX toolset syntax):

<Upgrade Id='PUT-UPGRADE-CODE-HERE'>
   <UpgradeVersion OnlyDetect='yes' Property='FOUND_RELATED_PACAKGE' />
</Upgrade>

That will set a Property named FOUND_RELATED_PACKAGE to the list of ProductCodes from already installed packages. Then you could block the install like so (using WiX toolset syntax):

<Condition Message='Another version of [ProductName] is already installed.">
    Installed OR NOT FOUND_RELATED_PACAKGE
</Condition>

Finally, it is very dangerous to block repair of an .msi package. There are many situations (including minor upgrade and patching) that depend on repair working for a package. It'd be much better to make your installation package resilient to repair since it is so fundamental to how things work.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM