tags:

views:

36

answers:

1

I am using RegistrySearch to set a property that is one of my directory and i see that when the registry value is of sub directory that doesn't exist than he value of the directory is not set, why is that?
In my case the ROLESDIR will be set to empty if the target directory doesn't exist (while the registry still point to it) --> the end result is that the the RoleDir will be installed directly under CONFDIR

<Property Id="ROLESDIR">
  <RegistrySearch Id="ROLESDIRRegistry" Type="directory" Root="HKLM" Key="Software\DummyName\UCM" Name="ConfRolesDirectoryPath" />
</Property>

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="SDIR">
      <Directory Id="CONFDIR" Name="Conf">
        <Directory Id="ROLESDIR" Name="Roles">
          <Directory Id="RoleDir" Name="MyRole" />
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Directory>
A: 

Your question isnt very clear,

Can you give an example of the registry value.

I have used this in the past.

<Property Id="INSTALLDIR">
  <RegistrySearch Id="INSTALLDIRRegistry" Type="raw" Root="HKLM" Key="Software\Manufacturer\Product" Name="InstallDir" />
</Property>

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="INSTALLDIR" Name="ProductName">

This sets the INSTALLDIR to the location of the path in the registry value. I think in your case you are trying to set the path of a folder which already has a path defined to it by the wix code.

You might want to try something like this

<Directory Id="TARGETDIR" Name="SourceDir">
   <Directory Id="ROLESDIR" Name="Roles">
      <Directory Id="RoleDir" Name="MyRole" />
   </Directory>
   <Directory Id="ProgramFilesFolder">
      <Directory Id="SDIR">
         <Directory Id="CONFDIR" Name="Conf" />
      </Directory>
   </Directory>
</Directory>

Hope that helps

Charles Gargent
Your answer is correct , the issue occurred because i used Directory type - although it is not documented that the directory must exist