0

when I get my achitecture type like this:

<Property Id="PLATTFORM">
            <RegistrySearch Id="myRegSearchPalttform"
                Root="HKLM"
                Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
                Name="PROCESSOR_ARCHITECTURE"
                Type="raw">
            </RegistrySearch>
</Property>

and want to check if it is "AMD64" like this:

<?define myPlattform = [PLATTFORM] ?>  
<?if $(var.myPlattform) = AMD64 ?>
some stuff
        <?else ?>
some stuff
        <?endif ?>

it fails. When I set the value static:

<?define stest = AMD64 ?>  
        <?if $(var.stest) = AMD64 ?>

it goes in true scope. So why is the value from the registry(there is the value AMD64) not identical with my proof string????

Tanx in advance

Wim Coenen
  • 66,094
  • 13
  • 157
  • 251
user1216201
  • 21
  • 2
  • 5

1 Answers1

0

<?define myPlattform = [PLATTFORM] ?>

Probably because myPlattform is a preprocessor variable and gets assigned before the PLATTFORM property ever has a value. If you want to conditionally install different components, you can try this way: How to use conditions in features in WiX?

This questions is possibly a duplicate of Is there a way to set a preprocessor variable to the value of a property?.

Update: If your goal is to set an installation location based on architecture, and your architecture is determined by the "PLATTFORM" property using the registry search you specified, then you could try the following:

<Property Id="PLATTFORM">
  <RegistrySearch Id="myRegSearchPalttform"
      Root="HKLM"
      Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
      Name="PROCESSOR_ARCHITECTURE"
      Type="raw">
  </RegistrySearch>
</Property>

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="SomeValue" />
  </Directory>
</Directory>

<ComponentGroup Id="ProductComponentGroup">
  <Component Id="ProductComponent" Guid="INSERT-GUID-HERE" Directory="INSTALLFOLDER">
    <File Id="TestTextFile.txt" Source=".\TestTextFile.txt" KeyPath="yes"/>
  </Component>
</ComponentGroup>

<Feature Id="ProductFeature" Level="1">
  <ComponentGroupRef Id="ProductComponentGroup"/>
</Feature>

<SetDirectory Id="INSTALLFOLDER" Value="[ProgramFilesFolder]\SomeOtherValue">
  PLATTFORM="AMD"
</SetDirectory>

Note: See that I used the SetDirectory element. I generally download the WiX weekly releases and never used that element until testing the above sample. Therefore I'm not sure what version SetDirectory was first introduced.

Community
  • 1
  • 1
BryanJ
  • 8,485
  • 1
  • 42
  • 61
  • The point is, I have to change some directory path, depending on the architecture. How can I achieve this dynamically depending on a registry entry??? – user1216201 Feb 21 '12 at 09:19
  • I updated my answer to include some sample code that tries to accomplish what you clarified with your comment. – BryanJ Feb 23 '12 at 04:49