Installing .NET redistributable with Wix Bootstrap

2019-04-25 21:00发布

问题:

I'm new to Wix/Burn and am trying to understand some of the fundamentals. I have a simple bootstrapper that installs the required .net 4.0 framework using the following chain:

<Chain>
    <PackageGroupRef Id="NetFx40ClientRedist"/>
    <MsiPackage Id="MyApp" SourceFile="$(var.WixInstaller.TargetPath)" DisplayInternalUI="yes" />
</Chain>

as recommended by How To: Install the .NET Framework Using Burn. The application may be used on servers with no web access so it's important that .net be installed from a local redistributable. The bootstrapper seems to work very well and installs the framework as intended. The setup.exe file, though, is roughly the same size as the application (< 5 MB) so I have to assume that the framework is still being downloaded during installation.

Questions

  1. What, then, is the difference between "NetFx40ClientWeb" and "NetFx40ClientRedist" in the WixNetfxExtension package?

  2. How do I included a local redistributable in the boostrapper so that no download is needed?

EDIT:

I believe I found the answer here:

WiXNetFxExtension will check a sub-directory called "redist" where your bundle is for the package then download it if it doesn't exist at that path e.g. "redist\dotNetFx40_Client_setup.exe". This is standard Burn behaviour.

回答1:

the difference between the two are:
1. clientWeb - means you have to have a connection to the web and the .net 4.0 will be downloaded and after that installed on the machine.

2.clientRedist - means redistributable - meaning a full package which doesn't need any connection to the internet, you can install it on any computer.


if you use the redistributable package you should be fine - here is the example for .Net 4.5 , it is the same for .Net 4.0 only diff is the redistributable package.

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
  <Bundle Name="Prog" Version="1.0.0.0" Manufacturer="my Corporation" UpgradeCode="*">
    <Chain>
      <!-- TODO: Define the list of chained packages. -->
      <PackageGroupRef Id="Netfx45FullPackage" />
    </Chain>
  </Bundle>
  <Fragment>
    <PackageGroup Id="Netfx45FullPackage">
      <ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe" DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))" InstallCondition="(VersionNT &gt;= v6.0 OR VersionNT64 &gt;= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))" />

      <MsiPackage Id="MyProg" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="$(var.installerPath)\MyProgCore.msi" />
    </PackageGroup>
  </Fragment>
</Wix>