Wix: Cannot call DISM from Wix CustomAction

南笙酒味 提交于 2019-12-02 07:15:30

You can use the built in Wix QuietExec custom action to run the dism command line - this should simplify the installer quite a bit

    <CustomAction Id='AddIISComponent' Property='IISComponent' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /featurename:IIS-WebServerRole /all' Execute='immediate'/>
    <CustomAction Id="IISComponent" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="ignore" Impersonate="no" />
    <InstallExecuteSequence>
        <Custom Action="AddIISComponent" After="CostFinalize" />
        <Custom Action="IISComponent" After="InstallInitialize"><![CDATA[(NOT Installed)]]></Custom> 
    </InstallExecuteSequence>

Here's a complete sample

Not smart as I expected....but works.

    <CustomAction Id='AddDISMComponent1' Property='DISMComponent1' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServerRole /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent1" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent2' Property='DISMComponent2' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-RequestFiltering /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent2" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent3' Property='DISMComponent3' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HttpLogging /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent3" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent4' Property='DISMComponent4' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HealthAndDiagnostics /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent4" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent5' Property='DISMComponent5' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServerManagementTools /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent5" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent6' Property='DISMComponent6' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ManagementConsole /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent6" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent7' Property='DISMComponent7' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-IIS6ManagementCompatibility /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent7" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent8' Property='DISMComponent8' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-Metabase /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent8" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent9' Property='DISMComponent9' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServer /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent9" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent10' Property='DISMComponent10' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-Performance /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent10" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent11' Property='DISMComponent11' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HttpCompressionStatic /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent11" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent12' Property='DISMComponent12' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-CommonHttpFeatures /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent12" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent13' Property='DISMComponent13' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-StaticContent /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent13" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent14' Property='DISMComponent14' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-DefaultDocument /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent14" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent15' Property='DISMComponent15' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-DirectoryBrowsing /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent15" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent16' Property='DISMComponent16' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HttpErrors /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent16" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent17' Property='DISMComponent17' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ApplicationDevelopment /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent17" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent18' Property='DISMComponent18' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ASPNET /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent18" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent19' Property='DISMComponent19' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-NetFxExtensibility /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent19" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent20' Property='DISMComponent20' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ISAPIExtensions /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent20" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent21' Property='DISMComponent21' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ISAPIFilter /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent21" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <CustomAction Id='AddDISMComponent22' Property='DISMComponent22' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:NetFx3 /all /Source:[SXSFOLDER]' Execute='immediate'/>
    <CustomAction Id="DISMComponent22" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />

    <InstallExecuteSequence>
      <Custom Action="AddDISMComponent1" After="CostFinalize" />
      <Custom Action="AddDISMComponent2" After="AddDISMComponent1" />
      <Custom Action="AddDISMComponent3" After="AddDISMComponent2" />
      <Custom Action="AddDISMComponent4" After="AddDISMComponent3" />
      <Custom Action="AddDISMComponent5" After="AddDISMComponent4" />
      <Custom Action="AddDISMComponent6" After="AddDISMComponent5" />
      <Custom Action="AddDISMComponent7" After="AddDISMComponent6" />
      <Custom Action="AddDISMComponent8" After="AddDISMComponent7" />
      <Custom Action="AddDISMComponent9" After="AddDISMComponent8" />
      <Custom Action="AddDISMComponent10" After="AddDISMComponent9" />
      <Custom Action="AddDISMComponent11" After="AddDISMComponent10" />
      <Custom Action="AddDISMComponent12" After="AddDISMComponent11" />
      <Custom Action="AddDISMComponent13" After="AddDISMComponent12" />
      <Custom Action="AddDISMComponent14" After="AddDISMComponent13" />
      <Custom Action="AddDISMComponent15" After="AddDISMComponent14" />
      <Custom Action="AddDISMComponent16" After="AddDISMComponent15" />
      <Custom Action="AddDISMComponent17" After="AddDISMComponent16" />
      <Custom Action="AddDISMComponent18" After="AddDISMComponent17" />
      <Custom Action="AddDISMComponent19" After="AddDISMComponent18" />
      <Custom Action="AddDISMComponent20" After="AddDISMComponent19" />
      <Custom Action="AddDISMComponent21" After="AddDISMComponent20" />
      <Custom Action="AddDISMComponent22" After="AddDISMComponent21" />

      <Custom Action="DISMComponent1" After="InstallInitialize"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent2" After="DISMComponent1"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent3" After="DISMComponent2"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent4" After="DISMComponent3"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent5" After="DISMComponent4"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent6" After="DISMComponent5"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent7" After="DISMComponent6"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent8" After="DISMComponent7"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent9" After="DISMComponent8"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent10" After="DISMComponent9"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent11" After="DISMComponent10"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent12" After="DISMComponent11"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent13" After="DISMComponent12"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent14" After="DISMComponent13"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent15" After="DISMComponent14"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent16" After="DISMComponent15"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent17" After="DISMComponent16"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent18" After="DISMComponent17"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent19" After="DISMComponent18"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent20" After="DISMComponent19"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent21" After="DISMComponent20"><![CDATA[(NOT Installed)]]></Custom> 
      <Custom Action="DISMComponent22" After="DISMComponent21"><![CDATA[(NOT Installed)]]></Custom> 

    </InstallExecuteSequence>  
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!