I made a wix installer which successfully enables the IIS with asp by running the command Aspnet_regiis.exe on 64 bit system. However, this command has different path in .net framework folder depending on 32 bit or 64 bit system according to this linkIIS registration with ASP
on 32 bit system
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
and on 64 bit system
%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i
I need to extend my installer to cover both 32 bit and 64 bit platforms. I tried to this answer answer on platform independent by defining a preprocess variable based on the platform as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?if $(var.Platform) = x64 ?>
<?define IISRegCommand = "C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i" ?>
<?else ?>
<?define IISRegCommand = "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i" ?>
<?endif ?>
<Product Id="*" Name="IISRegistration" Language="1033" Version="1.0.0.0" Manufacturer="Eurotherm By Schneider-Electric" UpgradeCode="4bfb41e4-5701-4a47-9c4c-cdb657ab7a62">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<Feature Id="ProductFeature" Title="IISRegistration" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<CustomAction Id="IISRegistration" Directory="INSTALLFOLDER"
ExeCommand="$(var.IISRegCommand)"
Return="check"/>
<InstallExecuteSequence>
<Custom Action="IISRegistration" After="InstallFiles"></Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id="Company" Name="Company">
<Directory Id="INSTALLFOLDER" Name="Application" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent" Guid="">
<File Id="File1" Name="IISRegistration.txt" Source="IISRegistration.txt"></File>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
However, when I compile it with candle.exe I get the following error:
"error CNDL0150: Undefined preprocessor variable '$(var.Platform)'"
BTW, I am using wix 3.11. Is there any way I can resolve this?