Adding WIC as a requirement before .NET 4.0 in WiX Burn custom Managed Bootstrapper

ε祈祈猫儿з 提交于 2019-12-23 21:50:22

问题


I'm having trouble getting a burn bundle with a custom managed bootstrapper application to launch on certain platforms that do not come with Windows Imaging Component, which is required to install .NET 4.0 (Windows 2003 being one of them).

We are using the standard method of defining what the managed bootstrapper application requires:

<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full"/>

When this bootstrapper is run on a newly installed Windows 2003 R2 machine, it launches the standard requirements installer for .NET, which then fails with an error.

We have attempted to solve this issue by doing the following (with everything non-essential snipped):

...
<!-- Define WIC packages -->
<PackageGroup Id="PG.WIC">      
  ...
  <ExePackage Id="EP.wic_x64_enu" Cache="no" Compressed="no"  PerMachine="yes" Permanent="yes" Vital="no"  
     DisplayName="Windows Imaging Component for Windows Server 2003 x64"
     Name="{4A85FFDB-5563-4FE9-9C0E-C780A271BCC7}\WIC\wic_x64_enu.exe"
     SourceFile="$(var.SetupPrereq_SRC)\WindowsImagingComponent\x64\wic_x64_enu.exe"
     DownloadUrl="http://download.microsoft.com/download/6/4/5/645fed5f-a6e7-44d9-9d10-fe83348796b0/wic_x64_enu.exe"
     InstallCondition="(VersionNT=v5.2 AND VersionNT64 AND NOT NETFRAMEWORK40FULL)"
     InstallCommand="/q /norestart">
  </ExePackage>
</PackageGroup>
...
<!-- Define our own .NET package, and set it to be after the WIC package -->
<PackageGroup Id="PG.NetFx40Full">
  <ExePackage Id="EP.NetFx40Full" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes" Protocol="netfx4" 
      DisplayName="Microsoft .NET Framework 4"
      Name="{4A85FFDB-5563-4FE9-9C0E-C780A271BCC7}\NetFx\dotNetFx40_Full_x86_x64.exe"
      SourceFile="$(var.SetupPrereq_SRC)\NetFx\dotNetFx40_Full_x86_x64.exe"
      DownloadUrl="http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
      DetectCondition="NETFRAMEWORK40FULL"
      InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log %TEMP%\PG.NetFx40Full.log"
      RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot;"        
      After="EP.wic_x64_enu"        >
  </ExePackage>
</PackageGroup>
...
<!-- Change wixmbaprereqpackageid to point to our own package-->
<WixVariable Id="WixMbaPrereqPackageId" Value="PG.Netfx4Full" Overridable="no"/>
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
...
<Chain>
  <!--Windows Imaging Component-->
  <PackageGroupRef Id="PG.WIC"/>

  <!--.Net Framework 4 -->      
  <!--Custom offline package.-->
  <PackageGroupRef Id="PG.NetFx40Full"/>
  ...
</Chain>
...

This does not work. The prereq installer launches as usual, but when you click on the button to start the install, the progress bar flashes for a second and the installer exits. If the bundle is started again, the prereq installer launches, but only shows a title and a logo, but no buttons. We also tried putting the After condition on the PackageGroupRef for the .NET packagegroup, with similar results.

So, my question is: Is there a way to make burn install more than one package as a prerequisite for the managed bootstrapper, or is there any other way to solve this issue?


回答1:


With WiX v3.9 and later, add bal:PrereqSupportPackage="yes" (in v4.x it's bal:PrereqPackage) to a package that you want the prereq BA to install (it honors the InstallCondition).




回答2:


You can use dotNetInstaller, it's a setup bootstrapper for Windows. After you have installed wic (on x86 or x64) you can launch your Wix installer.

Here is some code that you can use in the dotNetInstaller configuration.xml There are three components: wic_x86, wic_x64 and the dot Net framework 4

  <component executable="&quot;#CABPATH\wic_x86_enu.exe&quot; /norestart /quiet" executable_silent="" executable_basic="" install_directory="" responsefile_source="" responsefile_target="" responsefile_format="none" uninstall_executable="" uninstall_executable_silent="" uninstall_executable_basic="" uninstall_responsefile_source="" uninstall_responsefile_target="" returncodes_success="" returncodes_reboot="" exeparameters="" exeparameters_basic="" exeparameters_silent="" uninstall_exeparameters="" uninstall_exeparameters_basic="" uninstall_exeparameters_silent="" disable_wow64_fs_redirection="False" id="Windows Imaging Component (x86)" display_name="Windows Imaging Component" uninstall_display_name="" os_filter="" os_filter_min="winXP" os_filter_max="" os_filter_lcid="" type="exe" installcompletemessage="" uninstallcompletemessage="" mustreboot="False" reboot_required="" must_reboot_required="False" failed_exec_command_continue="" allow_continue_on_error="False" default_continue_on_error="False" required_install="True" required_uninstall="True" selected_install="True" selected_uninstall="True" note="" processor_architecture_filter="x86" status_installed="" status_notinstalled="" supports_install="True" supports_uninstall="False" show_progress_dialog="True" show_cab_dialog="True">
  <embedfile sourcefilepath="#APPPATH\presetup\wic_x86_enu.exe" targetfilepath="#TEMPPATH\wic_x86_enu.exe" />
  <installedcheck filename="#SYSTEMPATH\WindowsCodecs.dll" fileversion="" comparison="exists" defaultvalue="False" type="check_file" description="Installed Check" />
</component>
<component executable="&quot;#CABPATH\wic_x64_enu.exe&quot; /norestart /quiet" executable_silent="" executable_basic="" install_directory="" responsefile_source="" responsefile_target="" responsefile_format="none" uninstall_executable="" uninstall_executable_silent="" uninstall_executable_basic="" uninstall_responsefile_source="" uninstall_responsefile_target="" returncodes_success="" returncodes_reboot="" exeparameters="" exeparameters_basic="" exeparameters_silent="" uninstall_exeparameters="" uninstall_exeparameters_basic="" uninstall_exeparameters_silent="" disable_wow64_fs_redirection="False" id="Windows Imaging Component (x64)" display_name="Windows Imaging Component" uninstall_display_name="" os_filter="" os_filter_min="winXP" os_filter_max="" os_filter_lcid="" type="exe" installcompletemessage="" uninstallcompletemessage="" mustreboot="False" reboot_required="" must_reboot_required="False" failed_exec_command_continue="" allow_continue_on_error="False" default_continue_on_error="False" required_install="True" required_uninstall="True" selected_install="True" selected_uninstall="True" note="" processor_architecture_filter="x64" status_installed="" status_notinstalled="" supports_install="True" supports_uninstall="False" show_progress_dialog="True" show_cab_dialog="True">
  <embedfile sourcefilepath="#APPPATH\presetup\wic_x64_enu.exe" targetfilepath="#TEMPPATH\wic_x64_enu.exe" />
  <installedcheck filename="#SYSTEMPATH\WindowsCodecs.dll" fileversion="" comparison="exists" defaultvalue="False" type="check_file" description="Installed Check" />
</component>
<component executable="&quot;#CABPATH\dotNetFx40_Full_x86_x64.exe&quot; /norestart /quiet" executable_silent="" executable_basic="" install_directory="" responsefile_source="" responsefile_target="" responsefile_format="none" uninstall_executable="" uninstall_executable_silent="" uninstall_executable_basic="" uninstall_responsefile_source="" uninstall_responsefile_target="" returncodes_success="" returncodes_reboot="3010" exeparameters="" exeparameters_basic="" exeparameters_silent="" uninstall_exeparameters="" uninstall_exeparameters_basic="" uninstall_exeparameters_silent="" disable_wow64_fs_redirection="False" id=".NET Framework 4 (English)" display_name="Microsoft .NET Framework 4" uninstall_display_name="" os_filter="" os_filter_min="winXP" os_filter_max="" os_filter_lcid="" type="exe" installcompletemessage="" uninstallcompletemessage="" mustreboot="False" reboot_required="" must_reboot_required="False" failed_exec_command_continue="" allow_continue_on_error="False" default_continue_on_error="False" required_install="True" required_uninstall="True" selected_install="True" selected_uninstall="True" note="" processor_architecture_filter="" status_installed="" status_notinstalled="" supports_install="True" supports_uninstall="False" show_progress_dialog="True" show_cab_dialog="True">
  <installedcheck path="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" fieldname="Install" fieldvalue="1" defaultvalue="False" fieldtype="REG_DWORD" comparison="match" rootkey="HKEY_LOCAL_MACHINE" wowoption="NONE" type="check_registry_value" description="Installed Check" />
  <embedfile sourcefilepath="#APPPATH\presetup\dotNetFx40_Full_x86_x64.exe" targetfilepath="#TEMPPATH\dotNetFx40_Full_x86_x64.exe" />
</component>


来源:https://stackoverflow.com/questions/12727583/adding-wic-as-a-requirement-before-net-4-0-in-wix-burn-custom-managed-bootstrap

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