Search code examples
wixwindows-installer.net-framework-versionwix-extension

Wix detect .NET 4.5.2 in bundle


I am trying to make an installer bundle for .NET 4.5.2.

I followed these instructions, and it works fine for that .NET version.

But when I change the version, as below, it does not detect the installed .NET version when I run the installer for the second time:

  <ExePackage Id="Netfx452" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q /norestart"
    SourceFile="$(var.ProjectDir)Resources\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
    DetectCondition="(Netfx4FullVersion=&quot;4.5.51209&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.51209&quot;))"
    InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.51209&quot; OR Netfx4x64FullVersion=&quot;4.5.51209&quot;))"/>

Solution

  • This is only supported in WiX 3.9:

    1. Include a reference to WixNetFxExtension.dll

      enter image description here

    2. In your Bundle.wxs file, add the following to your <Bundle><Chain> element

      <PackageGroupRef Id="NetFx452Redist" />
      

      Alternatively, substitute any of the following for the Id attribute's value:

      PackageGroup ID     Description
      NetFx452Web         .Net Framework 4.5.2 web setup.
      NetFx452Redist      .Net Framework 4.5.2 standalone setup.
      

    Here is a short example of final markup:

    <Bundle Name="My App" Version="1.0.0.0" Manufacturer="Me" UpgradeCode="{YOUR-GUID-HERE}">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
        <Chain>
            <PackageGroupRef Id="NetFx452Redist" />
            <MsiPackage SourceFile="$(var.AppInstaller.TargetPath)" />
        </Chain>
    </Bundle>