用于部署使用 Visual Studio 2015 在 Windows 7 上开发的 C++ exe 的可再发行组件
Redistributables for deploying C++ exe developed with Visual Studio 2015 on Windows 7
我使用 Visual Studio 2015(在 Windows 10)开发了一个 32 位 C++ 应用程序。我想将它部署到 运行ning Windows 7 及更高版本的机器上。
我整理了一个 WiX 安装程序,并包含 VC++ 可再发行合并模块,如 here 所述。我包含的合并模块是 C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC140_CRT_x86.msm
.
此安装程序似乎可以正常工作,但在 Windows 7 上安装的程序不会 运行,抱怨缺少 api-ms-win-crt-runtime-l1-1-0.dll
。
通过搜索,我怀疑来自 here 的可再发行包 vc_redist.x86.exe
中可能有额外的文件,但 WiX 文档告诉我使用 msm 而不是 exe。
也有可能合并模块安装失败。我没有看到任何错误,但我没有重新运行它并启用日志来检查这种可能性。
另一个选择可能是使用 burn
,但我不熟悉这个工具;如果它是正确的,我会走那条路,但如果可能的话,我更愿意坚持使用 MSI。
VC++ 运行时可再发行组件在 Visual Studio 2015 年变得更加复杂。请参阅 the VC team blog post 关于通用 CRT。基本上,合并模块不足:
There will not be a merge module for the Universal CRT. If you currently use the CRT merge modules and still want to deploy the Visual C++ libraries centrally, we recommend that you move to the above mentioned Windows Update package or to the VCRedist. Alternatively, you may choose to link statically to the Universal CRT and the Visual C++ libraries.
我们 运行 遇到了 MSI 软件包无法使用 MSI Error 1618: 'Another installation is already in progress' during installation/uninstallation.
安装可再发行组件的麻烦 我们使用引导程序安装了带有 WIX 的 2015 可再发行组件。例如:
<Chain>
<!-- Microsoft Visual C++ 2015 x86 libraries -->
<ExePackage Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="EXAMPLE_PATH\vc_redist.x86.exe" InstallCommand="/install /passive /norestart">
</ExePackage>
<MsiPackage Id="MainPackage" SourceFile="YOUR_MSI_PACKAGE.msi" DisplayInternalUI="no" Compressed="yes" Vital="yes"/>
</Chain>
值得注意的是,现在可以将通用 C 运行时 DLL 与您的应用程序一起分发。 MSDN blog post 描述步骤:
- Install the Windnows 10 SDK
- 转到
C:\Program Files (x86)\Windows Kits\Redist\ucrt
并找到适用于您的目标平台的 DLL
- 将它们复制到应用程序的程序目录中
它们不大。总共约2兆。
我最终使用了这种技术,因为:
- 不需要我创建单独的 WiX 包然后 bootstrap 它们;
- 不需要用户运行任何额外的安装程序
我不能说它是否适用于所有计算机,但它适用于我测试过的计算机。
我使用 Visual Studio 2015(在 Windows 10)开发了一个 32 位 C++ 应用程序。我想将它部署到 运行ning Windows 7 及更高版本的机器上。
我整理了一个 WiX 安装程序,并包含 VC++ 可再发行合并模块,如 here 所述。我包含的合并模块是 C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC140_CRT_x86.msm
.
此安装程序似乎可以正常工作,但在 Windows 7 上安装的程序不会 运行,抱怨缺少 api-ms-win-crt-runtime-l1-1-0.dll
。
通过搜索,我怀疑来自 here 的可再发行包 vc_redist.x86.exe
中可能有额外的文件,但 WiX 文档告诉我使用 msm 而不是 exe。
也有可能合并模块安装失败。我没有看到任何错误,但我没有重新运行它并启用日志来检查这种可能性。
另一个选择可能是使用 burn
,但我不熟悉这个工具;如果它是正确的,我会走那条路,但如果可能的话,我更愿意坚持使用 MSI。
VC++ 运行时可再发行组件在 Visual Studio 2015 年变得更加复杂。请参阅 the VC team blog post 关于通用 CRT。基本上,合并模块不足:
There will not be a merge module for the Universal CRT. If you currently use the CRT merge modules and still want to deploy the Visual C++ libraries centrally, we recommend that you move to the above mentioned Windows Update package or to the VCRedist. Alternatively, you may choose to link statically to the Universal CRT and the Visual C++ libraries.
我们 运行 遇到了 MSI 软件包无法使用 MSI Error 1618: 'Another installation is already in progress' during installation/uninstallation.
安装可再发行组件的麻烦 我们使用引导程序安装了带有 WIX 的 2015 可再发行组件。例如:
<Chain>
<!-- Microsoft Visual C++ 2015 x86 libraries -->
<ExePackage Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="EXAMPLE_PATH\vc_redist.x86.exe" InstallCommand="/install /passive /norestart">
</ExePackage>
<MsiPackage Id="MainPackage" SourceFile="YOUR_MSI_PACKAGE.msi" DisplayInternalUI="no" Compressed="yes" Vital="yes"/>
</Chain>
值得注意的是,现在可以将通用 C 运行时 DLL 与您的应用程序一起分发。 MSDN blog post 描述步骤:
- Install the Windnows 10 SDK
- 转到
C:\Program Files (x86)\Windows Kits\Redist\ucrt
并找到适用于您的目标平台的 DLL - 将它们复制到应用程序的程序目录中
它们不大。总共约2兆。
我最终使用了这种技术,因为:
- 不需要我创建单独的 WiX 包然后 bootstrap 它们;
- 不需要用户运行任何额外的安装程序
我不能说它是否适用于所有计算机,但它适用于我测试过的计算机。