我做了一個wix安裝程序,它通過在64位系統上運行命令Aspnet_regiis.exe成功啓用IIS的asp。但是,該命令具有根據此鏈接IIS registration with ASP在wix安裝程序中使用ASP平臺無關的IIS註冊
在32位系統
%WINDIR%\ Microsoft.NET \框架\ V2.0.50727取決於32位或64位系統中的.NET Framework的文件夾不同的路徑\ ASPNET_REGIIS.EXE -i
,並在64位系統
%WINDIR%\ Microsoft.NET \ Framework64 \ V2.0.50727 \ ASPNET_REGIIS.EXE -i
我需要延長我的安裝程序覆蓋32位和64位pl atforms。我通過基於該平臺的定義預處理變量嘗試這個答案answer on platform independent如下:
<?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>
然而,當我與candle.exe我收到以下錯誤編譯:
「錯誤CNDL0150:未定義預處理器變量'$(var.Platform)'「
順便說一句,我使用的是wix 3.11。 有什麼辦法可以解決這個問題嗎?