ClickOnce 前提条件の VC++ 再頒布可能バージョンの指定
-
02-07-2019 - |
質問
ClickOnce アプリケーションは、Visual C++ 2005 再頒布可能パッケージを必要とするサードパーティ ツールを使用しています。VC++ 2008 再頒布可能パッケージのみがインストールされている場合、サードパーティ ツールは機能しません。ただし、Visual Studio 2008 では、ClickOnce の前提条件により、VC++ 再頒布可能ファイルのバージョンを指定できません。VC++ 2008 の前提条件が追加されますが、これはほとんどの場合意味があります。ただし、この状況では、以前のバージョンが必要です。ClickOnce は必須であるため、モジュールのマージは問題外です。バージョンを指定する方法について何かアイデアはありますか?
解決
VS 2005 がインストールされているマシンを見つけることができれば、解決策はそれほど難しくないはずです。プロジェクトの [パブリッシュ] タブの [前提条件] ダイアログに表示される内容をカスタマイズできます。
- VS 2005 がインストールされているマシンで、次の場所に移動します。 \Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages そしてコピーしてください vsredist_x86 フォルダーを公開元のマシンに追加します。
- フォルダーの名前を変更して、その名前を付けます vsredist
_
x86_
2005 または同様のもの。 - フォルダー内で、 \ja\package.xml ファイル。変更
<String Name="DisplayName">
意味のあるものにタグを付ける (ビジュアルC++ 2005 ランタイム ライブラリ (x86)) 既存の 2008 パッケージと区別するためです。 - フォルダーをコピーします C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages.
- Visual Studio が開いている場合は再起動します。
ここで、[前提条件] ダイアログを開くと、2005 パッケージの新しいエントリが表示されるはずです。このソリューションを完全にはテストしていないため、いくつかの詳細を見逃している可能性がありますが、これが入門になれば幸いです。
他のヒント
アプリのマニフェスト ファイルを開いて、アプリがリンクする必要のある再ディストリビューションのバージョンを変更できると思います。マニフェスト内のリストは、C:\Windows\WinSxS ディレクトリにあるものと一致する必要があります。があります コードプロジェクトページ これは、さまざまな再頒布可能ファイルの使用についてわかりやすく説明しています。
Visual Studio 2005 をインストールしました。オリジナルのブートストラップは次のとおりです。
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86\
\ja\package.xml
<?xml version="1.0" encoding="utf-8" ?>
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
>
<!-- Defines a localizable string table for error messages-->
<Strings>
<String Name="DisplayName">Visual C++ Runtime Libraries (x86)</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">You do not have the permissions required to install Visual C++ Runtime Libraries (x86). Please contact your administrator.</String>
<String Name="InvalidPlatformWin9x">Installation of Visual C++ Runtime Libraries (x86) is not supported on Windows 95. Contact your application vendor.</String>
<String Name="InvalidPlatformWinNT">Installation of Visual C++ Runtime Libraries (x86) is not supported on Windows NT 4.0. Contact your application vendor.</String>
<String Name="GeneralFailure">A failure occurred attempting to install Visual C++ Runtime Libraries (x86).</String>
</Strings>
</Package>
\product.xml
<?xml version="1.0" encoding="utf-8" ?>
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Visual.C++.8.0.x86"
>
<!-- Defines list of files to be copied on build -->
<PackageFiles>
<PackageFile Name="vcredist_x86.exe"/>
</PackageFiles>
<InstallChecks>
<MsiProductCheck Property="VCRedistInstalled" Product="{A49F249F-0C91-497F-86DF-B2585E8E76B7}"/>
</InstallChecks>
<!-- Defines how to invoke the setup for the Visual C++ 8.0 redist -->
<!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace -->
<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 NT 4 or less -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
\vcredist_x86.exe
SHA1: 95040f80b0d203e1abaec4e06e0ec0e01c507d03