Tuesday, February 09, 2016

.Net Framework 4.6.1 Clickonce bootstrapper

1.  Create folder C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages\DotNetFX461

2. Create file Product.xml:
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode=".NETFramework,Version=v4.6.1">
  <!-- Defines list of files to be copied on build -->
  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="NDP461-KB3102436-x86-x64-AllOS-ENU.exe" HomeSite="DotNetFX461FullWebBootstrapper" PublicKey="3082010A028201010096715DED0646FA84CB9D5BB746C7B0E1B4113903ADB11573609CEBA7B66E1A3C3FFF65E334F1A6A5215E56996C58E492A10A5CC2D3DC522F0C659A20614053319C6C8F217DBAF9FE13505260953A5BB958A5746141A994E0AD264E4CA1977049275E7C67CA4F1E718446BC1D4BB6E20FC5C627C907E67A0AA51700194C7045382D81B450AAC567D1FA79BCC5CCA1729BF4253498F854DF123938122FA46BA59A7EC762D1DCCFED3D34F8B9DF3530BAEC7932A9E1A9AC554D4C7F4C56C3130B76F107F9CC47ACFB88D552A51E28FA3D2DCFCF849886716511CF85C9094486E16FE7B1FCAC4044A5A98B233F82499DD596595013591873FF430CAD2BD47F3040670203010001"/>
    <PackageFile Name="NDP461-KB3102438-Web.exe" HomeSite="DotNetFX461FullWebBootstrapper" CopyOnBuild="False" PublicKey="3082010A028201010096715DED0646FA84CB9D5BB746C7B0E1B4113903ADB11573609CEBA7B66E1A3C3FFF65E334F1A6A5215E56996C58E492A10A5CC2D3DC522F0C659A20614053319C6C8F217DBAF9FE13505260953A5BB958A5746141A994E0AD264E4CA1977049275E7C67CA4F1E718446BC1D4BB6E20FC5C627C907E67A0AA51700194C7045382D81B450AAC567D1FA79BCC5CCA1729BF4253498F854DF123938122FA46BA59A7EC762D1DCCFED3D34F8B9DF3530BAEC7932A9E1A9AC554D4C7F4C56C3130B76F107F9CC47ACFB88D552A51E28FA3D2DCFCF849886716511CF85C9094486E16FE7B1FCAC4044A5A98B233F82499DD596595013591873FF430CAD2BD47F3040670203010001"/>
  </PackageFiles>
  <RelatedProducts>
    <IncludesProduct Code=".NETFramework,Version=v4.6" />
  </RelatedProducts>
  <InstallChecks>
    <RegistryCheck Property="DotNet46Full_Release" Key="HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" Value="Release" />
    <RegistryCheck Property="DotNet46Full_OSIntegrated" Key="HKLM\SOFTWARE\Microsoft\NET Framework Setup\OS Integration" Value="v4" />
  </InstallChecks>
  <!-- Defines how to invoke the setup for .NET Framework redist -->
  <Commands Reboot="Immediate">
    <!--Command for downlevel and future Operating Systems where netfx is not integrated within OS.-->
    <Command PackageFile="NDP461-KB3102436-x86-x64-AllOS-ENU.exe" Arguments=" /q /norestart /ChainingPackage FullX64Bootstrapper" EstimatedInstalledBytes="437362964" EstimatedInstallSeconds="600" EstimatedTempBytes="2095870765">
      <!-- These checks determine whether the package is to be installed -->
      <InstallConditions>
        <!-- This command is only for Samesite -->
        <BypassIf Property="InstallMode" Compare="ValueEqualTo" Value="HomeSite" />
        <!-- This indicates .NET Framework Full is already installed -->
        <BypassIf Property="DotNet46Full_Release" Compare="ValueGreaterThanOrEqualTo" Value="394271" />
        <!-- If netfx is part of the OS, then bypass this command. -->
        <BypassIf Property="DotNet46Full_OSIntegrated" Compare="ValueEqualTo" Value="1" />
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on less than Windows Vista -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.0.0" String="InvalidPlatformWinNT" />
        <!-- Block install if the platform is IA-64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="IA64" String="InvalidPlatformArchitecture" />
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="3010" Result="SuccessReboot" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="false" String="GeneralFailure" />
      </ExitCodes>
    </Command>
    <!--Command for Operating Systems where netfx is integrated within OS.-->
    <Command PackageFile="NDP461-KB3102436-x86-x64-AllOS-ENU.exe" Arguments=" /q /norestart /ChainingPackage FullX64Bootstrapper" EstimatedInstalledBytes="437362964" EstimatedInstallSeconds="600" EstimatedTempBytes="2095870765">
      <!-- These checks determine whether the package is to be installed -->
      <InstallConditions>
        <!-- This command is only for Samesite -->
        <BypassIf Property="InstallMode" Compare="ValueEqualTo" Value="HomeSite" />
        <!-- This indicates .NET Framework Full is already installed -->
        <BypassIf Property="DotNet46Full_Release" Compare="ValueGreaterThanOrEqualTo" Value="394271" />
        <!-- If netfx is not part of the OS, then bypass this command. -->
        <BypassIf Property="DotNet46Full_OSIntegrated" Compare="ValueNotEqualTo" Value="1" />
        <BypassIf Property="DotNet46Full_OSIntegrated" Compare="ValueNotExists" Value="1" />
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on OS less than Windows 8.0 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.2.0" String="InvalidPlatformWinNT" />
        <!-- Skip install if OS is Win10 or above -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThan" Value="10.0.0" />
        <!-- Block install if the platform is IA-64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="IA64" String="InvalidPlatformArchitecture" />
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="3010" Result="SuccessReboot" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="false" String="GeneralFailure" />
      </ExitCodes>
    </Command>
    <!--Command for downlevel and future Operating Systems where netfx is not integrated within OS.-->
    <Command PackageFile="NDP461-KB3102438-Web.exe" Arguments=" /q /norestart /ChainingPackage FullX64Bootstrapper /lcid 1033" EstimatedInstalledBytes="437362964" EstimatedInstallSeconds="600" EstimatedTempBytes="468232836">
      <!-- These checks determine whether the package is to be installed -->
      <InstallConditions>
        <!-- This command is only for Samesite -->
        <BypassIf Property="InstallMode" Compare="ValueNotEqualTo" Value="HomeSite" />
        <!-- This indicates .NET Framework Full is already installed -->
        <BypassIf Property="DotNet46Full_Release" Compare="ValueGreaterThanOrEqualTo" Value="394271" />
        <!-- If netfx is part of the OS, then bypass this command. -->
        <BypassIf Property="DotNet46Full_OSIntegrated" Compare="ValueEqualTo" Value="1" />
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on less than Windows Vista -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.0.0" String="InvalidPlatformWinNT" />
        <!-- Block install if the platform is IA-64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="IA64" String="InvalidPlatformArchitecture" />
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="3010" Result="SuccessReboot" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="false" String="GeneralFailure" />
      </ExitCodes>
    </Command>
    <!--Command for Operating Systems where netfx is integrated within OS.-->
    <Command PackageFile="NDP461-KB3102438-Web.exe" Arguments=" /q /norestart /ChainingPackage FullX64Bootstrapper" EstimatedInstalledBytes="437362964" EstimatedInstallSeconds="600" EstimatedTempBytes="2095870765">
      <!-- These checks determine whether the package is to be installed -->
      <InstallConditions>
        <!-- This command is only for Samesite -->
        <BypassIf Property="InstallMode" Compare="ValueNotEqualTo" Value="HomeSite" />
        <!-- This indicates .NET Framework Full is already installed -->
        <BypassIf Property="DotNet46Full_Release" Compare="ValueGreaterThanOrEqualTo" Value="394271" />
        <!-- If netfx is not part of the OS, then bypass this command. -->
        <BypassIf Property="DotNet46Full_OSIntegrated" Compare="ValueNotEqualTo" Value="1" />
        <BypassIf Property="DotNet46Full_OSIntegrated" Compare="ValueNotExists" Value="1" />
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on OS less than Windows 8.0 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.2.0" String="InvalidPlatformWinNT" />
        <!-- Skip install if OS is Win10 or above -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThan" Value="10.0.0" />
        <!-- Block install if the platform is IA-64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="IA64" String="InvalidPlatformArchitecture" />
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="3010" Result="SuccessReboot" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="false" String="GeneralFailure" />
      </ExitCodes>
    </Command>
  </Commands>
</Product>

3. Within "en" (or whatever language you are localizing) folder create "package.xml":
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" Name="DisplayName" Culture="Culture" LicenseAgreement="eula.rtf">
  <!-- Defines list of files to be copied on build -->
  <PackageFiles>
    <PackageFile Name="eula.rtf" />
  </PackageFiles>
  <!-- Defines a localizable string table for error messages-->
  <Strings>
    <String Name="DisplayName">Microsoft .NET Framework 4.6.1 (x86 and x64)</String>
    <String Name="Culture">en</String>
    <String Name="AdminRequired">Administrator permissions are required to install Microsoft .NET Framework 4.6.1. Contact your administrator.</String>
    <String Name="InvalidPlatformWinNT">Installation of the Microsoft .NET Framework 4.6.1 is not supported on this operating system. Contact your application vendor.</String>
    <String Name="InvalidPlatformArchitecture">This version of the Microsoft .NET Framework 4.6.1 is not supported on an IA-64 operating system. Contact your application vendor.</String>
    <String Name="DotNetFX461FullWebBootstrapper">http://go.microsoft.com/fwlink/?linkid=671728</String>
    <String Name="GeneralFailure">A failure occurred attempting to install the Microsoft .NET Framework 4.6.1.</String>
  </Strings>
</Package>

SQL 2014 CLR Types (x86) Clickonce bootstrapper (ReportViewer 2015 is dependent on this)

1. Create folder C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages\SqlClrTypes_x86 _2014 (you can copy an older sql clr types bootstrapper)

2. product.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Microsoft.SqlServer.SQLSysClrTypes.12.0.x86"
>
<RelatedProducts>
<EitherProducts>
<DependsOnProduct Code=".NETFramework,Version=v4.6.1" />
<DependsOnProduct Code=".NETFramework,Version=v4.6" />
<DependsOnProduct Code=".NETFramework,Version=v4.6,Profile=Client" />
</EitherProducts>
</RelatedProducts>

    <PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="SQLSysClrTypes.msi" HomeSite="SQLSysClrTypesMsi" PublicKey="3082010a0282010100c2ded6cfe2b77f1165ffb363a9f372b9f124eb5fa41cb24459eb6f9cfb70db65699aab90315effde2b6411f5ed6ce9002182c390cc8219a3e39963658abdd3d5fb20a3e0197fb88d3c6afec8128de5d339ef4d4e3e86964c11b111849b2798883b2dd47d18f305e0ad4b043e437519e646c48c9ddb89d82487bef44727bf6d8ddc78b9c365a16f37eabc71a69dac8e8f8d88917ea83725d98124a988f46346eabb20c9012fd88e0cd9d9ede036fb64684dfc422f9120a9089a284a47a8f0fed9b27afdd8e83801bc8145ab3ae81a2add39833f07dbd8e18ffc392c369e019fef6877c8786f3ef820ff961a10bef1aad0619ea89a84bf3eaeafca0a59e58d8b050203010001" />
    </PackageFiles>

    <InstallChecks>
<RegistryCheck Property="IsViewerInstalled" Key="HKLM\SOFTWARE\Microsoft\Microsoft SQL Server 2014 Redist\SQL Server System CLR Types\CurrentVersion" Value="Install" />
    </InstallChecks>

    <Commands Reboot="Defer">
<Command PackageFile="SQLSysClrTypes.msi"
             Arguments="/q /norestart"
             EstimatedInstalledBytes="13000000"
             EstimatedInstallSeconds="150">

            <!-- These checks determine whether the package is to be installed -->
            <InstallConditions>
              <BypassIf Property="IsViewerInstalled" Compare="ValueExists" Value="1"/>

                <!-- Block install if user does not have admin privileges -->
                <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
            </InstallConditions>

            <ExitCodes>
                <ExitCode Value="0" Result="Success"/>
                <ExitCode Value="3010" Result="SuccessReboot"/>
                <ExitCode Value="4097" Result="Fail" String="AdminRequired"/>
                <ExitCode Value="4099" Result="Fail" String="WindowsInstallerImproperInstall"/>
                <ExitCode Value="4101" Result="Fail" String="AnotherInstanceRunning"/>
                <ExitCode Value="4113" Result="Fail" String="BetaProductFailure"/>
                <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
            </ExitCodes>

        </Command>
    </Commands>
</Product>

3.  Within the "en" (or whatever language you are localizing) folder, create package.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Package
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  Name="DisplayName"
  Culture="Culture"
  LicenseAgreement="eula.rtf"

    <PackageFiles>
        <PackageFile Name="eula.rtf"/>
    </PackageFiles>

    <!-- Defines a localizable string table for error messages-->
    <Strings>
        <String Name="DisplayName">Microsoft® System CLR Types for SQL Server® 2014 (x86)</String>
        <String Name="Culture">en</String>
        <String Name="AdminRequired">Administrator permissions are required to install Microsoft® System CLR Types for SQL Server® 2012. Contact your administrator.</String>
        <String Name="DotNetFxRequired">Installation of Microsoft® System CLR Types for SQL Server® 2012 requires Microsoft .NET Framework 3.5. Contact your application vendor.</String>
        <String Name="WindowsInstallerImproperInstall">Due to an error with Windows Installer, the installation of Microsoft® System CLR Types for SQL Server® 2012 cannot proceed.</String>
        <String Name="AnotherInstanceRunning">Another instance of setup is already running. The running instance must complete before this setup can proceed.</String>
        <String Name="BetaProductFailure">A beta version of Microsoft® System CLR Types for SQL Server® 2012 was detected on the computer. Uninstall any previous beta versions of Microsoft® System CLR Types for SQL Server® 2012 before continuing.</String>
        <String Name="GeneralFailure">A failure occurred attempting to install Microsoft® System CLR Types for SQL Server® 2012.</String>
      <!--<String Name="SQLSysClrTypesMsi">http://go.microsoft.com/fwlink/?LinkID=221257</String>    -->
      <String Name="SQLSysClrTypesMsi">https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x86/SQLSysClrTypes.msi</String>
    </Strings>

</Package>

ReportViewer 2015 Clickonce Bootstrapper

In order to have ReportViewer 2015 (version 12) as a clickonce prerequisite, you will need a 'dependson' for sql 2014 clr types which will be posted separately.

1.  Create folder C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages\ReportViewer2015 (you can copy an old ReportViewer bootstrapper)

2.  product.xml:
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft.  All rights reserved. -->
<Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Microsoft.ReportViewer.12.0"
>
  <RelatedProducts>
    <EitherProducts>
      <DependsOnProduct Code="Microsoft.Net.Framework.3.5.SP1" />
      <DependsOnProduct Code=".NETFramework,Version=v4.0,Profile=Client" />
      <DependsOnProduct Code=".NETFramework,Version=v4.0" />
      <DependsOnProduct Code=".NETFramework,Version=v4.5" />
    </EitherProducts>
    <DependsOnProduct Code="Microsoft.SqlServer.SQLSysClrTypes.12.0.x86" />
  </RelatedProducts>

  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="ReportViewer.msi" HomeSite="ReportViewerMsi" PublicKey="3082010a0282010100c2ded6cfe2b77f1165ffb363a9f372b9f124eb5fa41cb24459eb6f9cfb70db65699aab90315effde2b6411f5ed6ce9002182c390cc8219a3e39963658abdd3d5fb20a3e0197fb88d3c6afec8128de5d339ef4d4e3e86964c11b111849b2798883b2dd47d18f305e0ad4b043e437519e646c48c9ddb89d82487bef44727bf6d8ddc78b9c365a16f37eabc71a69dac8e8f8d88917ea83725d98124a988f46346eabb20c9012fd88e0cd9d9ede036fb64684dfc422f9120a9089a284a47a8f0fed9b27afdd8e83801bc8145ab3ae81a2add39833f07dbd8e18ffc392c369e019fef6877c8786f3ef820ff961a10bef1aad0619ea89a84bf3eaeafca0a59e58d8b050203010001" />
  </PackageFiles>

  <InstallChecks>
    <RegistryCheck Property="IsViewerInstalled" Key="HKLM\Software\Microsoft\Microsoft SQL Server 2014 Redist\Microsoft Report Viewer 2015 Runtime" Value="Version" />
  </InstallChecks>

  <Commands Reboot="Defer">
    <Command PackageFile="ReportViewer.msi"
         Arguments="/q /norestart"
         EstimatedInstalledBytes="13000000"
         EstimatedInstallSeconds="150">

      <!-- These checks determine whether the package is to be installed -->
      <InstallConditions>
        <BypassIf Property="IsViewerInstalled" Compare="VersionGreaterThanOrEqualTo" Value="12.0.0.0"/>

        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <ExitCode Value="4097" Result="Fail" String="AdminRequired"/>
        <ExitCode Value="4099" Result="Fail" String="WindowsInstallerImproperInstall"/>
        <ExitCode Value="4101" Result="Fail" String="AnotherInstanceRunning"/>
        <ExitCode Value="4113" Result="Fail" String="BetaProductFailure"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>

    </Command>
  </Commands>
</Product>

Take note that the PublicKey is 3082010a0282010100c2ded6cfe2b77f1165ffb363a9f372b9f124eb5fa41cb24459eb6f9cfb70db65699aab90315effde2b6411f5ed6ce9002182c390cc8219a3e39963658abdd3d5fb20a3e0197fb88d3c6afec8128de5d339ef4d4e3e86964c11b111849b2798883b2dd47d18f305e0ad4b043e437519e646c48c9ddb89d82487bef44727bf6d8ddc78b9c365a16f37eabc71a69dac8e8f8d88917ea83725d98124a988f46346eabb20c9012fd88e0cd9d9ede036fb64684dfc422f9120a9089a284a47a8f0fed9b27afdd8e83801bc8145ab3ae81a2add39833f07dbd8e18ffc392c369e019fef6877c8786f3ef820ff961a10bef1aad0619ea89a84bf3eaeafca0a59e58d8b050203010001

3. Within "en" subfolder (or whatever language you are localizing) package.xml:
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft.  All rights reserved. -->
<Package
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  Name="DisplayName"
  Culture="Culture"
  LicenseAgreement="eula.rtf"
>

    <PackageFiles>
        <PackageFile Name="eula.rtf"/>
    </PackageFiles>

    <!-- Defines a localizable string table for error messages-->
    <Strings>
        <String Name="DisplayName">Microsoft Report Viewer 2015 Runtime</String>
        <String Name="Culture">en</String>
        <String Name="AdminRequired">Administrator permissions are required to install Microsoft Report Viewer 2014 Runtime. Contact your administrator.</String>
        <String Name="DotNetFxRequired">Installation of Microsoft Report Viewer 2014 Runtime requires Microsoft .NET Framework 3.5 SP1 or above. Contact your application vendor.</String>
        <String Name="WindowsInstallerImproperInstall">Due to an error with Windows Installer, the installation of Microsoft Report Viewer 2014 Runtime cannot proceed.</String>
        <String Name="AnotherInstanceRunning">Another instance of setup is already running. The running instance must complete before this setup can proceed.</String>
        <String Name="BetaProductFailure">A beta version of Microsoft Report Viewer 2014 Runtime was detected on the computer. Uninstall any previous beta versions of Microsoft Report Viewer 2014 Runtime before continuing.</String>
        <String Name="GeneralFailure">A failure occurred attempting to install Microsoft Report Viewer 2014 Runtime.</String>
      <String Name="ReportViewerMsi">https://download.microsoft.com/download/A/1/2/A129F694-233C-4C7C-860F-F73139CF2E01/ENU/x86/ReportViewer.msi</String>  
    </Strings>

</Package>