Monday, November 17, 2008

Common property problems

For MSI newcomers, a common hurdle appears to be figuring out that property names are case-sensitive, followed by figuring out what capitalization to use. Most common mistakes:

  • Installed, not INSTALLED
  • Yet INSTALLDIR, not Installdir or InstallDir
  • REMOVE (usu. in REMOVE="ALL" to detect uninstallation), not Remove
  • TARGETDIR, not TargetDir or Targetdir or etc.

If you choose the wrong capitalization, MSI thinks you’re making up a new property with an empty value, meaning conditions that use the erroneous names probably won’t evaluate the way you want them to. ICE46 will help.

And the most common resolutions to “How come my property value disappeared/went back to its default value?”–type problems:

  • Only the values of public properties—those with all-uppercase names: MYPROP, not MyProp—are passed from the UI sequence to the Execute sequence, so use a public property in your UI-sequence action or dialog box control if you want to use the value to make system changes using the Registry table, IniFile table, and so on.
  • While you’re reflecting on things, look into SecureCustomProperties.
  • If you’re calling MsiGetProperty, make sure the last argument (the value-buffer-size variable) is initialized to a value large enough to hold the property value. If you’re calling MsiGetProperty multiple times, reset the buffer size before each call.
  • As before, reading a property value during deferred execution (with Session.Property or MsiGetProperty) requires use of CustomActionData.

No comments: