I'm using the following code to install Windows features (like the IIS) within my msi-setup which also installs my wcf services.
<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>
Working fine, except that I need the IIs to be already installed during the service installation (to get a list of the installed websides, ect. in the UI). I created a secound Setup Project and put the code in there but it only executes my command if I include a dummy file:
<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>
Also I don't want a secound item in my "installed applications" list. Where would be the "normal" position for this? Can I execute my command direct from the Bootstrapper? Or can I execute the Custiom Action before the UI is loaded and any conditions are checked?
<Chain >
<PackageGroupRef Id="NetFx45Web"/>
<MsiPackage SourceFile="ServiceSetup.msi" EnableFeatureSelection="yes" DisplayInternalUI="yes" ForcePerMachine="yes"/>
</Chain>
The solution was actually pretty easy. Before="CostFinalize" installs the features in the "preparing" dialog.
<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 >