我的ClickOnce应用程序使用了一个需要Visual C++ 2005可再发行组件的第三方工具。如果只安装了VC++ 2008可再发行组件,则该第三方工具将无法正常工作。然而,在Visual Studio 2008中,ClickOnce先决条件不允许指定VC++可再发行组件的版本;它会添加一个VC++ 2008先决条件,这在大多数情况下是有意义的。然而,在这种情况下,需要较早的版本。由于需要ClickOnce,因此合并模块是不可行的。有没有什么办法可以指定版本?
_
x86_
2005或类似的名称。<String Name="DisplayName">
标记以使其有意义(例如:Visual C++ 2005 Runtime Libraries (x86)),以区分其与现有的2008包。现在,当您打开先决条件对话框时,您应该会看到一个新的2005包条目。我没有完全测试这个解决方案,所以可能会漏掉一些细节,但希望这可以帮助您入门。
我相信您可以打开应用程序的清单文件,并修改应用程序应链接的redists版本。清单中的列表应与您在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