VC++的正确分发方式运行时文件

发布于 2024-08-19 18:48:33 字数 613 浏览 2 评论 0原文

我有一个 MFC 应用程序,我正在尝试打包以进行部署。它似乎依赖于文件“msvcr90.dll”、“msvcp90.dll”和“mfc90.dll”。分发这些文件的正确方法是什么?

我无法使用合并模块,因为我的安装程序不支持它们。 我知道我可以运行 VCRedist_x86.exe,但由于各种原因我不想这样做。

据我所知,我唯一的选择是将文件安装为私有并排程序集。这是正确的吗?

根据 http://msdn.microsoft.com/en- us/library/ms235317(VS.80).aspx 安装私有程序集的正确方法是将“Microsoft.VC90.CRT”和“Microsoft.VC90.MFC”文件夹复制到与可执行的。这是解决问题的正确方法吗?它可以工作,但以这种方式复制系统文件似乎有点 20 世纪 90 年代的感觉。谁能向我展示另一个执行此操作的应用程序(或至少是演示项目)的示例?

最后,我什么时候需要担心为我的应用程序分发 .manifest 文件?我是否应该显式安装 XML 文件,或者它是否以某种方式嵌入到我的可执行文件中?

I have an MFC application which I am trying to package for deployment. It seems to depend on the files 'msvcr90.dll', 'msvcp90.dll' and 'mfc90.dll'. What is the correct way to distribute these files?

I can't use merge modules as my installer doesn't support them.
I know I can run VCRedist_x86.exe, but I don't want to do this for various reasons.

As far as I can see my only alternative is to install the files as Private Side-by-Side assemblies. Is this correct?

According to http://msdn.microsoft.com/en-us/library/ms235317(VS.80).aspx the correct way to install a private assembly is to copy the 'Microsoft.VC90.CRT' and 'Microsoft.VC90.MFC' folders to the same folder as the executable. Is this the correct way to solve the problem? It works, but it seems a bit 1990s to copy system files in this manner. Can anyone show me an example of another application (or at least a demo project) that does this?

Finally, when do I need to worry about distributing a .manifest file for my application? Am I supposed to explicitly install the XML file, or is it embedded in my executable somehow?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

猫性小仙女 2024-08-26 18:48:33

您还可以考虑与 MFC 和 CRT 静态链接,然后只需要发送 EXE 文件。不过,这有优点也有缺点。

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.

千柳 2024-08-26 18:48:33

我想说,将这些 dll 与您的 exe 一起放置就足够了,因为当前路径是首先查找它们的位置。

当然,您应该努力安装可再发行版本,因为这是更安全的方法。

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.

半暖夏伤 2024-08-26 18:48:33

通常我会说您应该在目标计算机上安装所需的可再发行组件,因为它是“干净的方式”。但你也可以采用 90 年代的风格。这很大程度上取决于您使用哪个 CRT/MFC 库来构建应用程序。这可以在清单文件中进行检查。您还可以强制应用程序与指定的库绑定。如果没有任何定义,VS2008 通常会绑定 9.0.21022.8,并

#define _BIND_TO_CURRENT_VCLIBS_VERSION 1

使用最新的库。您还可以绑定指定版本:

#define _CRT_ASSEMBLY_VERSION "9.0.30729.1"

和/或

#define _MFC_ASSEMBLY_VERSION "9.0.30729.1"

因此,如果您想采用 90 年代风格,请从 C:\Windows\Winsxs\ 复制文件,并从您绑定的文件夹中获取 DLL例如,如果您将 CRT 用于 x64 应用程序或等效的 x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0,则来自 amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_99b61f5e8371c1d4。 30729.1_none_99b61f5e8371c1d 对于 x86 CRT 版本。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文