我有一个使用 Visual Studio 2015 开发的 c++ 应用程序,以及一个 Wix 安装程序和一个 Burn Bootstrap 。该应用程序的早期版本能够使用 Visual Studio 合并模块来安装必要的先决条件,但在使用 Visual Studio 2015 时,这似乎不是一个选项(请参阅 Redistributables for deploying C++ exe developed with Visual Studio 2015 on Windows 7 )。
按照该链接中的建议,我们已经开始使用带有 vital="yes"的 ExePackage 安装带有 Burn 的 vcredist。这通常效果很好 - 我们有几个客户由于 vcredist 的各种问题而安装失败。直到最近,这些都是会导致安装失败的错误。
在过去的几天里,我们收到了几份由于安装了更新版本的可再发行组件而导致安装程序失败的报告:vcredist 失败,错误代码为 0x80070666,这导致我们的 Bootstrap 失败。
我的问题是:
请您参考如下方法:
SystemFolder 的事实而变得复杂。和 System64Folder相对于 Windows Installer 中的类似变量,它们是相反的。搜索 VC14 的示例:<!-- Detect existing version of VC ++ 2015 x64 libraries -->
<util:FileSearch Id="GetVC14X64Exists" Condition="VersionNT64" Variable="vc14x64Exists" Path="[SystemFolder]vcruntime140.dll" Result="exists"/>
<util:FileSearch Id="GetVC14X64Version" Condition="VersionNT64" Variable="vc14x64Version" Path="[SystemFolder]vcruntime140.dll" Result="version"/>
<!-- Detect existing version of VC ++ 2015 x86 libraries -->
<util:FileSearch Id="GetVC14X86onX64Exists" Condition="VersionNT64" Variable="vc14x86Exists" Path="[System64Folder]vcruntime140.dll" Result="exists"/>
<util:FileSearch Id="GetVC14X86onX64Version" Condition="VersionNT64" Variable="vc14x86Version" Path="[System64Folder]vcruntime140.dll" Result="version"/>
<util:FileSearch Id="GetVC14X86onX86Exists" Condition="NOT VersionNT64" Variable="vc14x86Exists" Path="[SystemFolder]vcruntime140.dll" Result="exists"/>
<util:FileSearch Id="GetVC14X86onX86Version" Condition="NOT VersionNT64" Variable="vc14x86Version" Path="[SystemFolder]vcruntime140.dll" Result="version"/>
变量
vc14x64Exists和 vc14x64Version然后可以在 DetectCondition 中使用确定是否安装了 64 位版本的 VC14:DetectCondition="vc14x64Exists AND vc14x64Version >= v14.0.nnnnn"
同样的
DetectCondition对于 VC14 的 32 位版本是:DetectCondition="vc14x86Exists AND vc14x86Version >= v14.0.nnnnn"
注:在这两种情况下,您都需要替换
nnnnn使用您在安装程序中包含的 vcredist 的内部版本号。编辑 1:作为替代方案,您可以使用升级代码搜索来检测 VC Redist 的存在,如 here 所述。 .
编辑 2:在我编写的安装程序中,我通常不会尝试检测 VC Redist 的存在。相反,我让 VC Redist 安装程序运行,让它自己决定是安装、升级还是什么都不做。
a) 14.0.23026 - 可从 Microsoft 的链接 here 下载.
b) 14.0.23506 - 随 Visual Studio 2015 Update 1 提供。
c) 14.0.23918 - 随 Visual Studio 2015 Update 2 提供。
尽管更新版本的 vcredist 已随 Visual Studio 更新一起发布,但 Microsoft 尚未更新可从其网站下载的版本。
<ExitCode Value="1638" Behavior="success"/> 告诉 Burn 忽略已安装的错误代码 0x80070666。 .请注意,1638 = 0x666。例如:<!-- Microsoft Visual C++ 2015 x86 libraries -->
<PackageGroup Id="VC14RedistX86">
<ExePackage
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Name="Redist\vcredist14_x86.exe"
SourceFile="$(var.RedistPath)\VC14\vcredist_23918_x86.exe"
InstallCommand="/install /quiet /norestart">
<!-- -->
<ExitCode Value="3010" Behavior="forceReboot"/>
<!-- Ignore "Newer version installed" error -->
<ExitCode Value="1638" Behavior="success"/>
</ExePackage>
</PackageGroup>
我最近遇到了一个类似的问题,我正在处理的产品安装程序因错误 0x80070666 而停止。问题是已经安装了较新版本的 vcredist。我最终使用的解决方案是:a) 包含最新版本的 vcredist (14.0.23918),b) 添加
<ExitCode Value="1638" Behavior="success"/>如果已经安装了 vcredist 的 future 更新版本,则指示告诉 burn 不要抛出错误。


