IIS 7.5如果禁用IIS,则只需安装一次

时间:2012-02-23 15:19:33

标签: wix iis-7.5 wix3.5

您好我使用以下代码在Windows 7中启用IIS 7.5。它的工作正常。但问题是每次运行安装程序(.MSi)IIS安装和卸载时间也启用IIS7.5,如何设置条件检查iis7.5是否禁用然后我要安装IIS。我正在使用wix3.5

请帮帮我。

 <CustomAction Id="InstallIISCA" PatchUninstall="no" Return="check" Property="INSTALLIISPROP" Execute="oncePerProcess" HideTarget="yes" Impersonate="yes"
       ExeCommand=" /Online /Enable-Feature /FeatureName:IIS-WebServerRole /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASPNET /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-WebServerManagementTools /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-WindowsAuthentication /FeatureName:IIS-IISCertificateMappingAuthentication /FeatureName:IIS-IPSecurity /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-ManagementConsole "/>
<InstallExecuteSequence>
  <Custom Action="InstallIISCA" Before="ConfigureIIs" />
</InstallExecuteSequence>
<Property Id="INSTALLIISPROP" Value="dism.exe"></Property>

1 个答案:

答案 0 :(得分:0)

您可以添加多个限制自定义操作运行时间的条件。要仅在安装时运行IIS检查,请将Custom元素更改为:

  <Custom Action="InstallIISCA" Before="ConfigureIIs">
    Not Installed
  </Custom>

您的描述有一些关于条件的连续句子。如果启用了IIS,我认为你还要求不安装的条件(?你的意思是安装?)。为此,首先为该条件设置属性(此处,检查IIS的版本以确定其是否已安装)

  <Property Id="IIS_MAJOR_VERSION">
    <RegistrySearch Id="CheckIISVersion" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Name="MajorVersion" Type="raw" />
  </Property>

然后在自定义操作条件中包含该属性:

  <Custom Action="InstallIISCA" Before="ConfigureIIs">
    Not Installed AND IIS_MAJOR_VERSION
  </Custom>

并且猜测你已经有了#34; ConfigureIIS&#34;行动,所以它不是不必要地运行。