0

I am trying to install a DLL into another products directory. I find the directory by doing the following RegistrySearch:

<Property Id="CUSTOMPATH">
  <RegistrySearch Id="CustomPath"
                  Root="HKLM"
                  Key="SOFTWARE\Wow6432Node\XXXXX\XXXXX\XXXX"
                  Name="MY Install Path"
                  Type="raw" />
</Property>

Can someone tell me how to use this property to install components of my product into this directory?

I have tried this approach but get an error that []'s are not valid for DestinationDirectory attribute.

<DirectoryRef Id="MyInstallFolder">
  <Component Id="MySharedDll.dll" Guid="some-guid">
    <File Id='MyFile.dll' Name='MyFile.dll' DiskId='1' Source='MySourceDir\MyFile.dll'>
      <CopyFile Id='x_MyFile.dll' DestinationDirectory='[REGISTRYSEARCHPATHFOUND]'/>
    </File>
  </Component>
</Directory>
rharrison33
  • 1,252
  • 4
  • 18
  • 34

1 Answers1

1

A couple things.

First: REGISTRYSEARCHPATHFOUND != CUSTOMPATH.

Second: The CopyFile@DestinationDirectory (per the doco) only works for keys that exist in the directory table at build time. Your property doesn't exist until after AppSearch. So instead you should use the DestinationProperty attribute instead. Also you will ditch the []'s since the attribute already expects a property name not a formatted string.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • This works, and I am able to copy the files into the proper directory. But now I have another problem. I have 2 versions of my product copying some shared dlls into a common directory in another company's program files directory. And when I uninstall one version, those dllls get removed. Why is reference counting not working here? I thought if the components have the same guid then reference counting should work. – rharrison33 Nov 21 '13 at 19:22
  • The components need to have the same component guid ID's, the same keyfiles and the sharedcomponent attribute set. – Christopher Painter Nov 21 '13 at 19:36
  • The components have the same guid, but how do I make sure they have the same keyfiles and sharecomponent attribute set? – rharrison33 Nov 21 '13 at 19:45
  • 1
    In a WiX world the easiest way is to put the components into a Fragment / Library and then reference the same component in two different installers. ( DRY - Don't Repeat Yourself ) In a Windows Installer / InstallShield world you build the components into a merge module and reference the module in two different installer builds. – Christopher Painter Nov 21 '13 at 21:44
  • The above comment is a great suggestion. To see how to do this, go here: http://stackoverflow.com/questions/2768749/how-do-i-share-a-wix-fragment-in-two-wix-projects – rharrison33 Nov 21 '13 at 21:55