Correct way to distribute VC++ runtime files

≯℡__Kan透↙ 提交于 2019-12-04 05:11:54

You could also consider statically linking with both MFC and the CRT, then you only need to ship your EXE files. There are pros and cons to this though.

I would say that is enough to put these dlls along with your exe, because the current path is where they are firstly looked for.

Of course, you should strive to install the redistributable as that's the safer way to go.

Simon Linder

Normally I would say that you should install the required redistributable on the target machine as it is the "clean way". But you can also do it the 90s style. It strongly depends which CRT/MFC lib you are using to build the application. This can be inspected within the manifest file. You can also force the application to bind with a specified lib. Without any define VS2008 normally binds the 9.0.21022.8, with

#define _BIND_TO_CURRENT_VCLIBS_VERSION 1

the most recent libs are taken. You can also bind with a specified version:

#define _CRT_ASSEMBLY_VERSION "9.0.30729.1"

and/or

#define _MFC_ASSEMBLY_VERSION "9.0.30729.1"

So if you want to do it the 90s style, copy the files from C:\Windows\Winsxs\ and take the DLLs from that folder you binded with, e.g. from amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_99b61f5e8371c1d4 if you use CRT for an x64 application or the equivalent x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_99b61f5e8371c1d for the x86 version of CRT.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!