2

我正在使用以下代码在我的 msi-setup 中安装 Windows 功能(如 IIS),它还安装了我的 wcf 服务。

<Property Id="INSTALLIISPROP" Value="C:\Windows\System32\dism.exe"></Property>
<CustomAction Id="InstallIISCA" Return="check" Property="INSTALLIISPROP" Execute="deferred" HideTarget="yes"  Impersonate="yes"
      ExeCommand="/online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-WebServerManagementTools /featurename:IIS-ManagementConsole" ></CustomAction>
<InstallExecuteSequence>
  <Custom Action="InstallIISCA" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

工作正常,除了我需要在服务安装期间已经安装 II(以获取已安装网站的列表,等等。在 UI 中)。我创建了一个第二个安装项目并将代码放在那里,但如果我包含一个虚拟文件,它只会执行我的命令:

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
         <Component Id="ProductComponent" Guid="ff876420-51ed-4bfc-bfd0-167a6333bf5e">
     <File Id="Product.wxs" Source="Product.wxs" KeyPath="yes" Checksum="yes"/>
         </Component>
    </ComponentGroup>
</Fragment>

此外,我不希望在我的“已安装应用程序”列表中有第二个项目。这个的“正常”位置在哪里?我可以直接从引导程序执行我的命令吗?或者我可以在加载 UI 并检查任何条件之前执行自定义操作吗?

<Chain >
    <PackageGroupRef Id="NetFx45Web"/>
    <MsiPackage SourceFile="ServiceSetup.msi" EnableFeatureSelection="yes" DisplayInternalUI="yes" ForcePerMachine="yes"/>
</Chain>
4

1 回答 1

3

解决方案实际上非常简单。Before="CostFinalize" 在“准备”对话框中安装功能。

  <CustomAction Id="InstallIISCA" Return="ignore" Property="DISMPFAD" Execute="oncePerProcess" Impersonate="yes"
    ExeCommand="/online /enable-feature /all /featurename:IIS-WebServerRole /featurename:IIS-WebServer /featurename:IIS-CommonHttpFeatures /featurename:IIS-StaticContent /featurename:IIS-DefaultDocument /featurename:IIS-DirectoryBrowsing /featurename:IIS-HttpErrors /featurename:IIS-ApplicationDevelopment /featurename:IIS-ASPNET /featurename:IIS-ASPNET45 /featurename:IIS-NetFxExtensibility /featurename:IIS-NetFxExtensibility45 /featurename:IIS-ISAPIExtensions /featurename:IIS-ISAPIFilter /featurename:IIS-HealthAndDiagnostics /featurename:IIS-HttpLogging /featurename:IIS-LoggingLibraries /featurename:IIS-RequestMonitor /featurename:IIS-Security /featurename:IIS-RequestFiltering /featurename:IIS-HttpCompressionStatic /featurename:IIS-WebServerManagementTools /featurename:IIS-ManagementConsole /featurename:IIS-IPSecurity  /featurename:WAS-WindowsActivationService /featurename:WAS-ProcessModel /featurename:WAS-NetFxEnvironment /featurename:WAS-ConfigurationAPI /featurename:WCF-NonHTTP-Activation /featurename:WCF-Pipe-Activation45 /featurename:WCF-TCP-Activation45 /featurename:WCF-TCP-PortSharing45 /featurename:WCF-HTTP-Activation45" >
  </CustomAction>
  <InstallUISequence>
    <Custom Action="InstallIISCA" Before="CostFinalize" Overridable="yes">NOT Installed AND (VersionNT > 601)</Custom>
  </InstallUISequence >
于 2014-04-15T10:43:10.487 回答