Question

I'm trying to do an installer using wix 3.8. I can use custom properties to store my own input, but I'd like to use values that where inputs on a previously installed msi. Is there a way to accomplish such thing?.

Was it helpful?

Solution

To get you in the right direction add this (of course adapt it to your needs first) in your fist MSI:

<DirectoryRef Id="INSTALLDIR">
  <Component Id="RegistryEntries" Guid="{0AC76129-F8E2-47D3-B9FD-09B1E10A8541}">
    <RegistryKey Root="HKLM" Key="Software\Company123\App123" Action="create">
      <RegistryValue Type="integer" Name="SomeIntegerValue" Value="1" KeyPath="yes"/>
      <RegistryValue Type="string" Name="UserInput" Value="[USERINPUT]" />
    </RegistryKey>
  </Component>
</DirectoryRef>

Don't forget reference the component in your <Feature> <ComponentRef Id="RegistryEntries" /> When you install assign a value to the property [USERINPUT] e.g. msiexec /i your.msi /qb+ USERINPUT="the value to be saved in registry"

Then in the second MSI add something like this:

   <Property Id="READREGISTRY">
       <RegistrySearch Id="USERINPUT_Value" Root="HKLM" Key="Software\Company123\App123" Name="UserInput" Type="raw" />
   </Property>

The value/string you entered during installation USERINPUT= will be stored in your second MSI in the property READREGISTRY

Here a piece of log in my second msi:

PROPERTY CHANGE: Adding READREGISTRY property. Its value is 'testing registry wef wef wef w'.

Based on your installation where it might be Per User or Per Machine you may adjust the Root to HKCU for PerUser installs or leave it to HKLM for PerMachine.

For more information please refer to Wix documentation, hints: "How To: Write a Registry Entry During Installation" and "How To: Read a Registry Entry During Installation".

OTHER TIPS

Generally, no. There is no requirement for a Windows Installer package to record the input it takes from the user. Some do record some information in the registry and you might choose to rely on finding it there.

As an alternative, you might find that the other installer can be run without a UI and can be sufficiently controlled with properties passed into it. If so, you can write your own UI (one way would be a custom WiX Bootrapper Application [example]) to gather the inputs before running the installer.

Create a custom action within the MSI which gets installed first, then either write the values/user entries that you want into a file or registry. Within your final MSI read the values from registry/file and use it.

Here is an example of how you can read a value from the user and update the your app.config, this is not an apple to apple scenario, but this will guide you through it.

http://bensnose.blogspot.com/2013/03/more-custom-actions-with-wix.html

Disclaimer: I havent tried out what is mentioned in this blog post, but I have done things very similar and found that it has good explanation, thats why I posted the link to it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top