Sunday, December 15, 2013

WIX Installer RemotePayload Check for .NET 4.5.1

To get the RemotePayload to check and download .NET 4.5.1 and to check if you have .NET 4.5.1 installed on a Windows 8.1, 8, 7 or Vista, Use the code below which can be found by going to CodePlex and download Wix38-debug.zip
http://wix.codeplex.com/releases/view/115492

Download and extract all and navigate to src\ext\NetFxExtension\wixlib
In there you will find all files for all .NET frameworks. Pick the NetFx451.wxs and copy all code in there into your Bootstrapper installer application.

The language packs are included with the web exe installer, in the redist. they are not included.
see http://msdn.microsoft.com/en-us/library/5a4x27ek(v=vs.110).aspx

Build and Run, and it will download and install .NET 4.5.1.

Note that you need to replace the attribute values in Bundle element: MyApplicationName, MyCompanyName and MyUpgradeCode.

Also, I am executing my Wix Setup Project after checking .NET 4.5.1 in the Bootstrap project
"<MsiPackage SourceFile="$(var.InstallerSetup.TargetPath)" Compressed="yes" />"

To see how to check the .NET framework version:
http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx


<?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">
  <Bundle Name="MyApplicationName" Version="1.0.0.0" Manufacturer="MyCompanyName"
          UpgradeCode="MyUpgradeCode">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

    <Chain>
      <PackageGroupRef Id="NetFx451Web"/>
      <MsiPackage SourceFile="$(var.InstallerSetup.TargetPath)" Compressed="yes" />
    </Chain>
  </Bundle>
  <!--
  .NET 4.5.1 for windows 8.1 = 378675
  .NET 4.5.1 for windows 8 or 7 or Vista = 378758
  -->
  <?define NetFx451MinReleaseWin8_1 = 378675 ?>
  <!--<?define NetFx451MinReleaseWin8or7orVista = 378758 ?> THIS IS NOT NEEDED SINCE WE ARE CHECKING 'Greater Than 378675'-->
  <?define NetFx451WebLink = http://go.microsoft.com/fwlink/?LinkId=322115 ?>
  <!--<?define NetFx451RedistLink = http://go.microsoft.com/fwlink/?LinkId=322116 ?>-->
  <?define NetFx45EulaLink =  http://go.microsoft.com/fwlink/?LinkID=260867 ?>

  <Fragment>
    <util:RegistrySearch
        Id="NETFRAMEWORK45"
        Variable="NETFRAMEWORK45"
        Root="HKLM"
        Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
        Value="Release"
        Result="value" />
  </Fragment>
  <Fragment>
    <util:RegistrySearchRef Id="NETFRAMEWORK45"/>

    <PackageGroup Id="NetFx451Web">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx451FullWebLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx451FullWebLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx451FullWebLog].html&quot;"
          PerMachine="yes"
          DetectCondition="NETFRAMEWORK45 &gt;= $(var.NetFx451MinReleaseWin8_1)"
          Id="NetFx451Web"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx451WebLink)"
          LogPathVariable="NetFx451FullWebLog"
          Compressed="no"
          Name="redist\NDP451-KB2859818-Web.exe">
        <RemotePayload
            Size="1021432"
            Version="4.5.50938.18408"
            ProductName="Microsoft .NET Framework 4.5.1"
            Description="Microsoft .NET Framework 4.5.1 Setup"
            CertificatePublicKey="A260A870BE1145ED71E2BB5AA19463A4FE9DCC41"
            CertificateThumbprint="108E2BA23632620C427C570B6D9DB51AC31387FE"
            Hash="4CBEA1E408DB5B423E130931B9478972E6798431" />
      </ExePackage>
    </PackageGroup>
  </Fragment>


  <!--<Fragment>
    <util:RegistrySearchRef Id="NETFRAMEWORK45"/>

    <PackageGroup Id="NetFx451Redist">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx451FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx451FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx451FullLog].html&quot;"
          PerMachine="yes"
          DetectCondition="NETFRAMEWORK45 &gt;= $(var.NetFx451MinRelease)"
          Id="NetFx451Redist"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx451RedistLink)"
          LogPathVariable="NetFx451FullLog"
          Compressed="no"
          Name="redist\NDP451-KB2858728-x86-x64-AllOS-ENU.exe">
        <RemotePayload
            Size="70087104"
            Version="4.5.50938.18408"
            ProductName="Microsoft .NET Framework 4.5.1"
            Description="Microsoft .NET Framework 4.5.1 Setup"
            CertificatePublicKey="A260A870BE1145ED71E2BB5AA19463A4FE9DCC41"
            CertificateThumbprint="108E2BA23632620C427C570B6D9DB51AC31387FE"
            Hash="5934DD101414BBC0B7F1EE2780D2FC8B9BEC5C4D" />
      </ExePackage>
    </PackageGroup>
  </Fragment>-->

  <!-- set to Release number of the .NET Framework 4.5 if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45" Secure="yes">
      <RegistrySearch Id="NetFramework45" Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Arabic language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_AR_SA_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45ArSaLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1025" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Chinese (Simplified) language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_ZH_CN_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45ZhCnLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\2052" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Chinese (Traditional) language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_ZH_TW_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45ZhTwLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1028" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Czech language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_CS_CZ_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45CsCzLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1029" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Danish language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_DA_DK_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45DaDkLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1030" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Dutch language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_NL_NL_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45NlNlLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1043" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Finnish language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_FI_FI_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45FiFiLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1035" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 French language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_FR_FR_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45FrFrLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1036" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 German language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_DE_DE_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45DeDeLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1031" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Greek language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_EL_GR_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45ElGrLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1032" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Hebrew language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_HE_IL_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45HeIlLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1037" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Hungarian language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_HU_HU_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45HuHuLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1038" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Italian language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_IT_IT_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45ItItLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1040" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Japanese language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_JA_JP_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45JaJpLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1041" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Korean language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_KO_KR_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45KoKrLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1042" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Norwegian language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_NB_NO_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45NbNoLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1044" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Polish language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_PL_PL_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45PlPlLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1045" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Portuguese (Brazil) language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_PT_BR_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45PtBrLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1046" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Portuguese (Portugal) language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_PT_PT_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45PtPtLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\2070" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Russian language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_RU_RU_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45RuRuLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1049" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Spanish language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_ES_ES_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45EsEsLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\3082" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Swedish language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_SV_SE_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45SvSeLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1053" Name="Release" Type="raw" />
    </Property>
  </Fragment>

  <!-- set to Release number of the .NET Framework 4.5 Turkish language pack if installed (not set otherwise) -->
  <Fragment>
    <Property Id="NETFRAMEWORK45_TR_TR_LANGPACK" Secure="yes">
      <RegistrySearch Id="NETFRAMEWORK45TrTrLp" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full\1055" Name="Release" Type="raw" />
    </Property>
  </Fragment>
</Wix>

No comments:

Post a Comment