私の ClickOnce アプリケーションは、Visual C++ 2005 再頒布可能パッケージを必要とするサード パーティ ツールを使用しています。VC++ 2008 再頒布可能パッケージのみがインストールされている場合、サード パーティ ツールは機能しません。ただし、Visual Studio 2008 では、ClickOnce の前提条件により、VC++ 再頒布可能パッケージのバージョンを指定できません。VC++ 2008 の前提条件が追加されますが、これはほとんどの場合理にかなっています。ただし、この状況では、以前のバージョンが必要です。ClickOnce が必要なので、マージ モジュールは論外です。バージョンを指定する方法のアイデアはありますか?
3 に答える
VS 2005 がインストールされているマシンを見つけることができれば、解決策は難しくありません。プロジェクトの [発行] タブの [前提条件] ダイアログに表示される内容をカスタマイズできます。
- VS 2005 がインストールされているマシンで、\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packagesに移動し、公開元のマシンにvsredist_x86フォルダーをコピーします。
- フォルダーの名前を変更し、vsredist
_
x86_
2005などの名前にします。 - フォルダー内で、\en\package.xmlファイルを編集します。
<String Name="DisplayName">
タグを意味のあるもの ( Visual C++ 2005ランタイム ライブラリ (x86) ) に変更して、既存の 2008 パッケージと区別します。 - フォルダーをC:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packagesにコピーします。
- 開いている場合は、Visual Studio を再起動します。
これで、前提条件ダイアログを開くと、2005 パッケージの新しいエントリが表示されるはずです。このソリューションを完全にテストしたわけではないため、いくつかの詳細を見逃している可能性がありますが、これで開始できることを願っています.
アプリのマニフェスト ファイルを開いて、アプリがリンクする必要がある redist のバージョンを変更できると思います。マニフェストのリストは、C:\Windows\WinSxS ディレクトリにあるものと一致する必要があります。さまざまな再配布可能ファイルの使用について適切に説明しているCodeProject ページがあります。
Visual Studio 2005 をインストールしました。オリジナルのブートストラップは次のとおりです。
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86\
\en\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