2

我有一个 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&amp;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 的相关信息)。

只要安装了先决条件,任何一个选项都适合我(从网站下载或从与我的应用程序相同的位置下载)。

4

2 回答 2

0

MS存在一个未解决的问题。

https://connect.microsoft.com/VisualStudio/feedback/details/1604832/vcredist-bootstrapper-packages-in-vs-2015-sdk-arent-working

这是 2015 年可再发行软件包的链接。 https://www.microsoft.com/en-us/download/details.aspx?id=48145

于 2016-09-08T17:25:20.570 回答
0

对于 32 位操作系统,使用 regedit HKLM\Software\Microsoft\GenericBootstrapper\ 检查此注册表项

对于 64 位操作系统,HKLM\Software\Wow6432Node\Microsoft\GenericBootstrapper

路径值是您需要放置可再发行组件的位置。

例如,如果您想放置您的 VC++ 64 位可再发行组件(vc_redist.x64.exe)..

如果路径值中的位置是“C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\”,

将 vc_redist.x64.exe 文件放在“C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\vc_redistx64\”中。

重建项目,现在可以正常工作了

于 2018-07-17T07:43:39.190 回答