How to add custom prerequisite in ClickOnce

Visual Studio 2008 은 아래 Folder 에 Bootstrapper package 를 관리하고 있습니다.
\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\

이는 다음 Registry에서 관리 하고 있습니다.
HKLM\Software\Microsoft\GenericBootstrapper\3.5 의 Path key
즉, 위의 Key Path 값을 변경하면 Bootstapper 참조가 달라집니다.

Bootstrapper Package 를 추가하려면 다음 조건을 만족해야 합니다.

  1. EXE 또는 MSI file 로 구성된 Redistributable Component 로 구성되어야 합니다.
  2. Product Manifest file 인 product.xml 이 포함되어야 합니다. 이는 언어에 중립적인 Metadata 로서 언어에 종속적이지 않은 일반적인 Metadata 입니다.
  3. Package Manifest file 인 package.xml 이 포함되어야 합니다. 이는 일반적으로 각 언어별 에러 메시지를 포함하고 있습니다. Component 는 적어도 하나 이상의 package manifest 를 포함하고 있어야 합니다.

Product 과 Package Manifest Schema 에 대한 명세는 다음을 참조하셔서 작성하셔야 합니다.
https://msdn.microsoft.com/en-us/library/ms229223.aspx

Visual Studio 2008 SP1 을 설치하면 다음과 같이 필수 구성 요소를 선택 할 수 있습니다.

  • .NET Framework 2.0 (x86)
  • Visual C++ Runtime Libraries (IA64)
  • Visual C++ Runtime Libraries (x64)
  • Visual C++ Runtime Libraries (x86)
  • Windows Installer 3.1
  • .NET Framework Client Profile
  • .NET Framework 3.0 (x86)
  • .NET Framework 3.5
  • .NET Framework 3.5 SP1
  • Crystal Reports Basic for Visual Studio 2008 (x86, x64)
  • Microsoft Office 2007 Primary Interop Assembiles
  • Microsoft Visual Stduio 2008 Report Viewer
  • Microsoft Visual Basci PowerPacks 1.2
  • Visual Studio Tools for Office system 3.0 Runtime Service Pack 1
  • SQL Server 2005 Exprerss Edition SP2 (x86)

예를 들어,
Visual Studio Tools for the Office system 3.0 Runtime 과 Visual Studio Tools for the Office system 3.0 Runtime Service Pack1 을 분리하려면, 다음과 같이 하셔야 합니다.

  1. \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\ 에 VSTOR30 과 VSTOR30SP1 Folder 를 생성합니다.

  2. 각각의 Folder 에 Redistributable Package 를 복사합니다.

  3. product.xml 을 생성합니다.

    <?xml version="1.0" encoding="utf-8" ?>

    <!--

    ***********************************************************************

     

      Copyright (C) Microsoft Corporation. All rights reserved.

     

     THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY

     KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE

     IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A

     PARTICULAR PURPOSE.

    ***********************************************************************

    -->

    <Product

      xmlns="https://schemas.microsoft.com/developer/2004/01/bootstrapper"

      ProductCode="Microsoft.VSTORuntime.3.0">

      <RelatedProducts>

        <DependsOnProduct Code="Microsoft.Net.Framework.3.5" />

      </RelatedProducts>

      <!-- Defines the list of files to be copied on build. -->

      <PackageFiles CopyAllPackageFiles="false">

        <PackageFile Name="VSTOR30.exe" HomeSite="VSTORExe" PublicKey="3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B794C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C1378D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B28423C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D2085576810203010001"/>

      </PackageFiles>

      <InstallChecks>

        <MsiProductCheck Property="VSTORuntimeInstalled" Product="{8FB53850-246A-3507-8ADE-0060093FFEA6}"/>

      </InstallChecks>

      <!-- Defines how to run the Setup package. -->

      <Commands Reboot="Defer">

        <Command

          PackageFile="VSTOR30.exe"

          Arguments=' /q:a /c:"install /q /l"'

          EstimatedInstalledBytes="10000000"

          EstimatedTempBytes="10000000"

          EstimatedInstallSeconds="60">

          <InstallConditions>

            <BypassIf Property="VSTORuntimeInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>

            <!-- Requires the user to be an admin user when installing the prerequisite -->

            <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>

          </InstallConditions>

          <ExitCodes>

            <ExitCode Value="0" Result="Success"/>

            <ExitCode Value="1641" Result="SuccessReboot"/>

            <ExitCode Value="3010" Result="SuccessReboot"/>

            <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />

          </ExitCodes>

        </Command>

      </Commands>

    </Product>

       

    <?xml version="1.0" encoding="utf-8" ?>

    <!--

    ***********************************************************************

     

      Copyright (C) Microsoft Corporation. All rights reserved.

     

     THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY

     KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE

     IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A

     PARTICULAR PURPOSE.

    ***********************************************************************

    -->

    <Product

      xmlns="https://schemas.microsoft.com/developer/2004/01/bootstrapper"

      ProductCode="Microsoft.VSTORuntime.3.0.SP1">

      <RelatedProducts>

        <DependsOnProduct Code="Microsoft.Net.Client.3.5" />

      </RelatedProducts>

      <!-- Defines the list of files to be copied on build. -->

      <PackageFiles CopyAllPackageFiles="false">

         <PackageFile Name="vstor30sp1-KB949258-x86.exe" HomeSite="VSTOR30SP1" PublicKey="3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B794C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C1378D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B28423C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D2085576810203010001"/>

      </PackageFiles>

      <InstallChecks>

         <RegistryCheck Property="VSTORuntimeUpdateInstalled" Key="HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v3" Value="Update"/>

      </InstallChecks>

      <!-- Defines how to run the Setup package. -->

      <Commands Reboot="Defer">

        <Command

          PackageFile="vstor30sp1-KB949258-x86.exe"

          Arguments=' /q:a /c:"install /q /l"'

          EstimatedInstalledBytes="1500000"

          EstimatedTempBytes="1500000"

          EstimatedInstallSeconds="60">

          <InstallConditions>

            <BypassIf Property="VSTORuntimeUpdateInstalled" Compare="ValueGreaterThanOrEqualTo" Value="1"/>

            <!-- Requires the user to be an admin user when installing the prerequisite -->

            <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>

          </InstallConditions>

          <ExitCodes>

            <ExitCode Value="0" Result="Success"/>

            <ExitCode Value="1641" Result="SuccessReboot"/>

            <ExitCode Value="3010" Result="SuccessReboot"/>

            <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure"/>

          </ExitCodes>

        </Command>

      </Commands>

    </Product>

  4. en folder 를 생성하여, eula.rtf 및 package.xml 을 생성합니다.

  5. Visual Studio 2008 을 재 시작하면 다음과 같이 필수 구성요소에 VSTOR30 과 VSTOR30SP1 이 분리되어 나타나는 것을 확인 할 수 있습니다.