问题描述
我已经使用 Microsoft Visual Studio 2015 社区版构建了一个 C++ 应用程序.我正在使用高级安装程序来确保 Visual C++ Redistributable for Visual Studio 2015 是先决条件.
I've built a C++ application using Microsoft Visual Studio 2015 Community Edition. I'm using Advanced Installer to make sure that the Visual C++ Redistributable for Visual Studio 2015 is a prerequisite.
然而,可再发行组件的安装程序并不完美.我的一些用户报告说可再发行安装程序挂起,或者说安装失败,然后用户收到此程序无法启动,因为您的计算机缺少 MSVCP140.dll"错误.
However, the redistributable's installer isn't perfect. Some of my users have reported that the redistributable installer hangs, or it fails to install when it says it does, and then users get the "This program can't start because MSVCP140.dll is missing from your computer" error.
根据 Microsoft 的说法,我现在可以将可再发行的 DLL 与我的应用程序一起打包,尽管它们不能推荐:
According to Microsoft, I can now package the redistributable DLLs along with my application, though they don't recommend it:
要部署可再发行的 Visual C++ 文件,您可以使用 Visual Studio 中包含的 Visual C++ 可再发行包(VCRedist_x86.exe、VCRedist_x64.exe 或 VCRedist_arm.exe).... 也可以直接在应用程序本地文件夹中安装可再发行的 Visual C++ DLL,该文件夹包含您的可执行应用程序文件.出于维修原因,我们不建议您使用此安装位置.
To deploy redistributable Visual C++ files, you can use the Visual C++ Redistributable Packages (VCRedist_x86.exe, VCRedist_x64.exe, or VCRedist_arm.exe) that are included in Visual Studio. ... It's also possible to directly install redistributable Visual C++ DLLs in the application local folder, which is the folder that contains your executable application file. For servicing reasons, we do not recommend that you use this installation location.
C:Program Files (x86)Microsoft Visual Studio 14.0VC
edistx64Microsoft.VC140.CRT
中有4个文件.这是否意味着我只需要在安装过程中将它们复制到我的应用程序目录中?
There are 4 files in C:Program Files (x86)Microsoft Visual Studio 14.0VC
edistx64Microsoft.VC140.CRT
. Does that mean I just need to copy them to my application's directory during the install process?
- MyApp.exe
- concrt140.dll
- msvcp140.dll
- vccorlib140.dll
- vcruntime140.dll
这样做可以吗?我需要出示许可证吗?为什么没有更多的人这样做,而不是要求再次预安装可再发行组件?
Is this OK to do? Do I need to show a license? Why aren't more people doing this instead of requiring yet another preinstall of the redistributable?
推荐答案
C:Program Files (x86)Microsoft Visual Studio 14.0VC edistx64Microsoft.VC140.CRT
中有4个文件.这是否意味着我只需要在安装过程中将它们复制到我的应用程序目录中?
There are 4 files in
C:Program Files (x86)Microsoft Visual Studio 14.0VC edistx64Microsoft.VC140.CRT
. Does that mean I just need to copy them to my application's directory during the install process?
是的,你引用的段落就是这个意思.
Yes, and the paragraph you quoted means just that.
这样做可以吗?我需要出示许可证吗?为什么没有更多的人这样做,而不是要求再次预安装可再发行组件?
Is this OK to do? Do I need to show a license? Why aren't more people doing this instead of requiring yet another preinstall of the redistributable?
从技术上讲,这样做是可以的.如果你想学究一些,你可以在 readme
或 help/about
中加入注释,说明 VC++ 2015 可再发行组件在local"中提供部署"微软nofollow noreferrer">Visual C++ 中的部署(在 重新分发 Visual C++ 文件).
Technically, that's OK to do. If you want to be pedantic about it, you may include a note in the readme
or help/about
to the effect that VC++ 2015 redistributables provided in "local deployment" mode
as explicitly allowed by Microsoft's Deployment in Visual C++ (with more links to the file lists and licenses at Redistributing Visual C++ Files).
至于为什么更多的人不这样做,我猜(在那些关心的人中):
As to why more people don't do it, I'd guess that (among those who care at all):
- 对于像
MyApp.exe
这样的单模块应用程序,使用静态链接的所有内容来构建它会更容易,以消除外部依赖; - 不包含这些文件可以从分发(大概是下载)大小中节省 1 MB 以上;
- 使用运行时的私有副本运行(
本地部署"
)将更新的责任转移到维护者身上,以便在关键/安全修复的情况下必须重新发布包及时 - 与中央部署"
相反,它可能通过 Windows 更新交付,可能带来好的和坏的.
- for a single module app like
MyApp.exe
it's easier to build it with everything linked statically as to eliminate external dependencies to begin with; - not including those files saves 1+ MB from the distribution (presumably download) size;
- running with private copies of the runtime (
"local deployment"
) shifts the responsibility of updates to the maintainer, so that in case of a critical/security fix the package would have to be reissued timely - as opposed to"central deployment"
where it would likely be delivered via Windows Update, with both the good and bad that may bring.
这篇关于我可以将 Visual Studio 2015 C++ Redistributable DLL 与我的应用程序捆绑在一起吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!