Onur Simsek
Onur Simsek

Reputation: 13

How to set additional properties during RemoveExistingProducts

I am using the recommended way to upgrade (Use Upgrade and UpgradeVersion to detect the old version of the product and use RemoveExistingProducts after InstallInitialize

The thing is, during uninstall of the existing product, I need to pass additional properties to installer for preserving existing database. Is there a way to do that?

Upvotes: 1

Views: 750

Answers (2)

AntonyW
AntonyW

Reputation: 2414

If you are uninstalling from the command line, you can use

msiexec /x c:\Example.msi PROPERTY=VALUE

to initialise your properties.

Alternatively, you can store the properties in the registry and use something like :

<Property Id="PROPNAME">
  <RegistrySearch Id="PropNameRegistry" Type="raw" Root="HKLM" Key="Software\MyProduct\MyKey\PropValue" Name="MyPropName" />
</Property>

to retrieve them.

Upvotes: 1

Michael Urman
Michael Urman

Reputation: 15905

All a product being removed via RemoveExistingProducts receives is a single extra property UPGRADINGPRODUCTCODE. This property is set to match the ProductCode of the installer which is removing this other product. If you had a condition against this in the installer being removed, it can act accordingly. If not, you will need to make your UpgradeVersion OnlyDetect and block until it's gone, invoke its removal manually, or similar workarounds.

Upvotes: 4

Related Questions