Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 5308

Visual Studio 2017 で Visual C++ ”14” ランタイム ライブラリをインストーラーに含めた場合に発生する問題について (2)

$
0
0

こんにちは、Visual Studio サポート チームです。

今回は、先日ご案内した以下の記事に関連して、新しいバージョンのVisual C++ ランタイム ライブラリをご利用される際に発生する可能性がある問題とその対処方法をご案内いたします。

 

Visual Studio 2017 で Visual C++ “14” ランタイム ライブラリをインストーラーに含めた場合に発生する問題について
https://blogs.msdn.microsoft.com/jpvsblog/2017/06/22/vs2017-vc14-installer/

 

現象
作成したパッケージに含まれる Visual C++ “14” ランタイム ライブラリよりも、さらに新しいバージョンの Visual C++ “14” ランタイム ライブラリが既にインストールされているにもかかわらず、インストーラーの実行時にランタイム ライブラリのインストールが求められる。

 

原因
Visual C++ ランタイム ライブラリ用の Product.xml では、対象の製品がインストールされているかどうかの検証に Product Code を使用します。

この検証では、対象の Product Code の製品がインストールされているかどうかを調べますが、Visual C++ ランタイム ライブラリはアップデートごとに新しい Product Code を採番しているため、インストール対象のランタイム ライブラリよりも新しいバージョンのライブラリが既にインストールされていたとしても、それらは検出されないため、ライブラリのインストールが必要と判断される動作となります。

 

対処策
以下のように Product.xml の設定を変更することで、より新しいバージョンのライブラリが既にインストールされていた場合には、ライブラリのインストールをスキップさせることが可能です。

変更手順 :

1. Product.xml のバックアップを作成しておきます。各ファイルは既定で以下の場所に配置されます。

x86 版
Product.xml : <インストール ルート>BootstrapperPackagesvcredist_x86

x64 版
Product.xml : <インストール ルート>BootstrapperPackagesvcredist_x64

2. メモ帳などのエディタで各 xml ファイルを開き、以下の箇所を変更してファイルを保存します。

Product.xml (x86 版)

変更前

  <InstallChecks>
    <MsiProductCheck Property=”VCRedistInstalled” Product=”{C6CDA568-CD91-3CA0-9EDE-DAD98A13D6E1}”/>
  </InstallChecks>
  <!– Defines how to invoke the setup for the Visual C++ 14.0 redist –>
  <Commands Reboot=”Defer”>

    <Command PackageFile=”vcredist_x86.exe” Arguments=’ /q:a ‘>

      <!– These checks determine whether the package is to be installed –>

      <InstallConditions>

        <BypassIf Property=”VCRedistInstalled” Compare=”ValueGreaterThanOrEqualTo” Value=”3″/>

        <!– Block install if user does not have admin privileges –>

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

        <!– Block install on Win95 –>

        <FailIf Property=”Version9X” Compare=”VersionLessThan” Value=”4.10″ String=”InvalidPlatformWin9x”/>

        <!– Block install on Vista or below –>

        <FailIf Property=”VersionNT” Compare=”VersionLessThan” Value=”6.00″ String=”InvalidPlatformWinNT”/>

      </InstallConditions>

変更後

  <InstallChecks>
    <RegistryCheck Property=”VCRedistInstalledVersion” Key=”HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio14.0VCRuntimesx86″ Value=”Version” />
  </InstallChecks>
  <!– Defines how to invoke the setup for the Visual C++ 14.0 redist –>
  <Commands Reboot=”Defer”>

    <Command PackageFile=”vcredist_x86.exe” Arguments=’ /q:a ‘>

      <!– These checks determine whether the package is to be installed –>

      <InstallConditions>

        <BypassIf Property=”VCRedistInstalledVersion” Compare=”ValueGreaterThanOrEqualTo” Value=”v14.10.25008.00″ />

        <!– Block install if user does not have admin privileges –>

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

        <!– Block install on Win95 –>

        <FailIf Property=”Version9X” Compare=”VersionLessThan” Value=”4.10″ String=”InvalidPlatformWin9x”/>

        <!– Block install on Vista or below –>

        <FailIf Property=”VersionNT” Compare=”VersionLessThan” Value=”6.00″ String=”InvalidPlatformWinNT”/>

      </InstallConditions>

 

Product.xml (x64 版)

変更前

<InstallChecks>
    <MsiProductCheck Property=”VCRedistInstalled” Product=”…”/>
  </InstallChecks>
  <!– Defines how to invoke the setup for the Visual C++ 14.0 redist –>
  <Commands Reboot=”Defer”>

    <Command PackageFile=”vc_redist.x64.exe” Arguments=’ /q:a ‘>

      <!– These checks determine whether the package is to be installed –>

      <InstallConditions>

        <BypassIf Property=”VCRedistInstalled” Compare=”ValueGreaterThanOrEqualTo” Value=”3″/>

        <!– Block install if user does not have admin privileges –>

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

        <!– Block install on any platform other than x64 –>

        <FailIf Property=”ProcessorArchitecture” Compare=”ValueNotEqualTo” Value=”AMD64″ String=”InvalidOS”/>

        <!– Block install on Vista or below –>

        <FailIf Property=”VersionNT” Compare=”VersionLessThan” Value=”6.00″ String=”InvalidPlatformWinNT”/>

      </InstallConditions>

変更後

  <InstallChecks>
    <RegistryCheck Property=”VCRedistInstalledVersion” Key=”HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio14.0VCRuntimesx64″ Value=”Version” />
  </InstallChecks>
  <!– Defines how to invoke the setup for the Visual C++ 14.0 redist –>
  <Commands Reboot=”Defer”>

    <Command PackageFile=”vc_redist.x64.exe” Arguments=’ /q:a ‘>

      <!– These checks determine whether the package is to be installed –>

      <InstallConditions>

        <BypassIf Property=”VCRedistInstalledVersion” Compare=”ValueGreaterThanOrEqualTo” Value=”v14.10.25008.00″ />

        <!– Block install if user does not have admin privileges –>

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

        <!– Block install on any platform other than x64 –>

        <FailIf Property=”ProcessorArchitecture” Compare=”ValueNotEqualTo” Value=”AMD64″ String=”InvalidOS”/>

        <!– Block install on Vista or below –>

        <FailIf Property=”VersionNT” Compare=”VersionLessThan” Value=”6.00″ String=”InvalidPlatformWinNT”/>

      </InstallConditions>

 

RegistryCheck 要素で指定しているレジストリ キーに関する情報につきましては、下記のドキュメントでもご案内しておりますのであわせてご確認ください。

 

Redistributing Visual C++ Files
https://docs.microsoft.com/en-us/cpp/ide/redistributing-visual-cpp-files

なお、Bypassif 要素で指定するバージョンは、インストーラーに含めていただく Visual C++ “14” ランタイム ライブラリのバージョンにあわせて変更してください。必須コンポーネントを弊社の Web サイトからダウンロードするよう構成されている場合は、Package.xml で指定されている URL のリンク先からダウンロードしてバージョンをご確認ください。


Viewing all articles
Browse latest Browse all 5308

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>