34

I want to save the path of my application, installed with wix, in the windows registry. I tried the following:

<RegistryValue Root="HKLM" Key="Software\company\InstallLocation" Value="[#INSTALLLOCATION]" Type="string" Action="write" />

where INSTALLLOCATION is the Directory Id of the folder in Wix, but this doesn't work. It seems that the [#id] syntax is only for files...

I saw the following question but the blog he references seemingly is no more:

https://stackoverflow.com/questions/521825/saving-install-path-to-registry

Community
  • 1
  • 1
Max
  • 4,345
  • 8
  • 38
  • 64

1 Answers1

43

Just remove the # sign, leave only [INSTALLLOCATION] and it should work. The # symbol referes to file keys. Without the # it refers to a property and all directories become properties. See the article about Formatted data type for more details.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
  • 4
    The # symbol referes to file keys. Without the # refers to a property and all directories become properties. – Christopher Painter Feb 17 '11 at 13:36
  • 1
    See "Formatted (Windows)" http://msdn.microsoft.com/en-us/library/aa368609(v=vs.85).aspx – Michael Urman Feb 17 '11 at 13:58
  • Thanks! I tried to find how to do this but it seems the wix documentation is not that great.. (I think). – Max Feb 17 '11 at 14:08
  • 1
    I get a warning with this: "Warning: The 'WIXUI_INSTALLDIR' Property contains '[INSTALLLOCATION]' in its value which is an illegal reference to another property. If this value is a string literal, not a property reference, please ignore this warning. To set a property with the value of another property, use a CustomAction with Property and Value attributes." http://stackoverflow.com/a/7180242/1061602 – Adam Marshall Mar 07 '14 at 14:15