0

I have created one basic MSI project in InstallShield. I want to achieve one scenario. For this I'm setting one property at the time of installation using installScript function MsiSetProperty(). But I want also read the value of same property at the time of uninstallation. I need the value of property at uninstallation, which is set at the time of installation.

So is there any way to retrieve the value of property at uninstallation, which is set at the time of installation?

Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39

2 Answers2

0

Reading a property at uninstallation is the same as reading it during installation: you call MsiGetProperty(), and if it's in a deferred context you have to pass it through the CustomActionData property. Note as well that setting a property during a deferred context doesn't do much.

However what's probably tripping you up is that properties, in general, are not preserved across Windows Installer sessions. There are exceptions, such as DirProperties for installed components, that are automatically preserved. But most properties are simply forgotten when the current action ends. The typical recommendation is to follow the 'remember property pattern' which, in a nutshell, consists of saving the value of the property to a registry key, and reading it back with a system search.

Michael Urman
  • 15,737
  • 2
  • 28
  • 44
  • I have created one property "PROP123" in PropertyManager and set its value to 0. Then I have created one Custom Action "CA123" and in that i'm setting value of "PROP123" to 1. I'm executing "CA123" at the time of installation only. At the time of uninstallation when I'm reading "PROP123", I'm getting its value 0. Here I want value 1 at uninstallation. So can you please describe me how I can achieve this ? – Ajit Medhekar Apr 13 '16 at 12:29
0

I just tried a workaround for this. I'm setting registry value at the time of installation & reading that property at uninstallation and setting a value of it to property.

Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39
  • May I know please where did you write your [custom] code which executes during UnInstallation. I want to execute some code to when UnInstallation starts – Rajesh Mishra May 30 '18 at 12:11