1

I want to have 2 installers with common part. So I used merge module, and created 2 wix installers.

Here is what I want to achive with more details (problem described there was solved): wix installers with common component

I am using WixUI_InstallDir so user is able to choose directory where application will be installed. When second installer is launched I want to load previously choosen installation directory.

When user does not change default path all works fine. But if INSTALLDIR was changed in first installation, then second installer adds plugin to right path but also extracts core to default path - which is wrong. However right path (from previous installation) is shown on "Destination Folder" dialog.

Here is significant code:

<Property Id="CORE_INSTALLATION_PATH">
  <RegistrySearch Id="InstallFolderRegistrySearch" Type="raw" Root="HKLM" Key="SOFTWARE\PluginCompany\Plugins" Name="InstallFolder"/>
</Property>

<SetDirectory Id="INSTALLDIR" Value="[CORE_INSTALLATION_PATH]">CORE_INSTALLATION_PATH</SetDirectory>

<DirectoryRef Id="TARGETDIR">
  <Component Id="CoreRegistryEntries" Guid="{C1701385-12CA-47EF-9FB2-884139B56390}">
    <RegistryKey Root="HKLM" Key="SOFTWARE\PluginCompany\Plugins" Action="createAndRemoveOnUninstall">
      <RegistryValue Type="string" Name="InstallFolder" Value="[INSTALLDIR]" KeyPath="yes"/>
    </RegistryKey>
  </Component>
</DirectoryRef>

You can download and run full sample solution from https://github.com/bwojdyla/wixplugins/tree/04f61b89b0465311818bec1cc06371b3dced5671

Community
  • 1
  • 1
bwojdyla
  • 85
  • 10

2 Answers2

1

In logs I found this:

MSI (c) (38:CC) [08:54:03:324]: Dir (target): Key: INSTALLDIR   , Object: C:\Program Files (x86)\PluginCompanyFolder\PluginInstaller2\
MSI (c) (38:CC) [08:54:03:324]: Dir (target): Key: INSTALLDIR.751E70EB_CF76_413B_B8C8_231A31F9C946  , Object: C:\Program Files (x86)\PluginCompanyFolder\PluginInstaller\

So there are two properties INSTALLDIR and INSTALLDIR with guid. This second property is added by merge module and updating INSTALLDIR does not change second property. That is why core components were extracted to custom location by second installer.

To disable mudularization I used SuppressModularization attribute:

<Property Id="INSTALLDIR" SuppressModularization="yes"/>

Notice SuppressModularization description at: http://wixtoolset.org/documentation/manual/v3/xsd/wix/property.html

Use to suppress modularization of this property identifier in merge modules. Using this functionality is strongly discouraged; it should only be necessary as a workaround of last resort in rare scenarios.

bwojdyla
  • 85
  • 10
0

A couple or three things:

  1. Make sure you have the correct registry, maybe you need a Win64 search, maybe not, depends if the data is in the native registry or the x86 WOW one.

  2. If it's not too late, it's typically better to install shared components to a common location (such as the common files folder for your Company Name and Product Name) to avoid this kind of thing. It's perfectly ok if not all the files are in the main application folder, as long as the app doesn't care.

  3. Do the install with a verbose log and see what the AppSearch is doing - that's where it will set (or not) that property value. That's where you'll see if the property is being set or not, and therefore whether something else is going wrong later on.

PhilDW
  • 20,260
  • 1
  • 18
  • 28