我有一个 Visual Studio 安装项目,它安装了一个需要 VC++ 14 Redist 包的 x64 程序。
我根据图像选择了选项并在其中创建了一个文件夹结构:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages
我创建了 vcredist_x64 文件夹,其中包含:
vcredist_x64.exe
product.xml
en folder
在 en 文件夹中,我有:
package.xml
product.xml 的内容:
<?xml version="1.0" encoding="utf-8" ?>
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Visual.C++.11.0.x64"
>
<!-- Defines list of files to be copied on build -->
<PackageFiles>
<PackageFile Name="vcredist_x64.exe" HomeSite="VCRedistExe"/>
</PackageFiles>
<InstallChecks>
<MsiProductCheck Property="VCRedistInstalled" Product="{e46eca4f-393b-40df-9f49-076faf788d83}"/>
</InstallChecks>
<!-- Defines how to invoke the setup for the Visual C++ 11.0 redist -->
<!-- TODO: Needs EstimatedTempSpace, LogFile, and an update of EstimatedDiskSpace -->
<Commands Reboot="Defer">
<Command PackageFile="vcredist_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" Value="AMD64" Compare="ValueNotEqualTo" String="InvalidOS"/>
<!-- Block install on Vista or below -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.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>
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++ "14" Runtime Libraries (x64)</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">You do not have the permissions required to install Visual C++ Runtime Libraries (x64). Please contact your administrator.</String>
<String Name="InvalidOS">Installation of Visual C++ Runtime Libraries (x64) is supported only on x64 machines.</String>
<String Name="GeneralFailure">A failure occurred attempting to install Visual C++ Runtime Libraries (x64).</String>
<String Name="VCRedistExe">http://go.microsoft.com/fwlink/?LinkID=210622&clcid=0x409</String>
</Strings>
</Package>
当我构建安装项目时,它没有给出任何错误。
最初,当我没有该文件夹结构以及 xmls 时,我在构建时遇到错误:
enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'vcredist_x64\vcredist_x64.exe' for item 'Visual C++ "14" Runtime Libraries (x64)' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=616018.
但是我现在没有错误。问题是它没有安装 VC 可再发行依赖项。
我认为 xmls 中的 productcode 和其他参数不正确。此外,VCRedistExe 链接适用于 VC++2010,但在安装过程中不会下载任何内容。但是请注意,我在文件夹结构中有 vcredist_x64.exe,它是 VC++14 redist。
请帮助我,因为我也尝试了许多其他选项,但这个“官方”选项似乎不起作用(我找不到 Visual C++ Redistributable for Visual Studio 2015 的相关信息)。
只要安装了先决条件,任何一个选项都适合我(从网站下载或从与我的应用程序相同的位置下载)。