我正在使用以下代码在我的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>
工作正常,但我需要在服务安装期间安装IIs(以获取已安装的网站列表,如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>
此外,我不想在“已安装的应用程序”列表中找到一个secound项目。这个“正常”的位置在哪里?我可以直接从Bootstrapper执行我的命令吗?或者,我可以在加载UI并检查任何条件之前执行Custiom操作吗?
<Chain >
<PackageGroupRef Id="NetFx45Web"/>
<MsiPackage SourceFile="ServiceSetup.msi" EnableFeatureSelection="yes" DisplayInternalUI="yes" ForcePerMachine="yes"/>
</Chain>
答案 0 :(得分:3)
解决方案实际上非常简单。在=“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 >