应用程序不与VS 2008 SP1 DLL一起运行,以前的版本与RTM版本一起使用

编程入门 行业动态 更新时间:2024-10-28 16:25:36
本文介绍了应用程序不与VS 2008 SP1 DLL一起运行,以前的版本与RTM版本一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

由于我们从Visual Studio 6切换到Visual Studio 2008,我们一直使用MFC90.dll和msvc [pr] 90.dll以及清单文件在私人并排配置,以便不担心版本或将其安装到系统。

Pre-SP1之前,这工作正常(仍然在我们的开发人员机器上正常工作)。现在我们已经在SP1之后做了一些测试,自昨天上午以来我一直在拉我的头发。

首先,我们的NSIS安装程序脚本拉出dll和清单文件从redist文件夹。这些不再正确,因为应用程序仍链接到RTM版本。

所以我添加了 _BIND_TO_CURRENT_VCLIBS_VERSION = 1 到我们的所有项目,以便他们将使用redist文件夹中的SP1 DLL(或随后的新的服务包出来)。这花了我几个小时来找到这个。

我已经从编译中的中间文件文件夹中双重检查生成的清单文件,他们正确列出9.0.30729.1 SP1版本。我有双和三重检查取决于一个干净的机器:它所有链接到本地​​DLL没有错误。

运行应用程序时仍会出现以下错误:

应用程式无法正确初始化(0xc0150002)。点击确定即可终止申请。

微软已经提出了任何与我的具体问题相关的任何东西(但是有点击回到2005与此错误消息)。

任何一个有任何类似的问题SP1?

选项:

  • 查找问题并修复它,使其工作原理(首选)
  • 安装redist
  • 挖掘旧的RTM dll和清单文件,并删除#define以使用当前的。 (我已经在早期的安装程序生成它们,因为Microsoft将它们从您的redist文件夹中!)

编辑:我试过重新构建与定义关闭(链接到RTM DLL),只要RTM DLL安装在文件夹中,它的工作。如果SP1 DLL被删除,它会收到以下错误:

c:\Program Files \ ... \。 ..\X.exe

此应用程序无法启动,因为应用程序配置不正确。重新安装应用程式可能会解决这个问题。

没有其他人必须处理这个问题吗?

编辑:只是为了咧嘴,我下载并运行vcredist_x86.exe VS2008SP1在我的测试机。 工作。使用SP1 DLL。和我的RTM链接的应用程序。

解决方案

我在一个私人并列发布的 上个星期我自己已经战胜了这个问题,并认为自己有点专家现在;)

我99%确定不是所有的dll和静态库都重新编译SP1版。您需要输入

#define _BIND_TO_CURRENT_MFC_VERSION 1 #define _BIND_TO_CURRENT_CRT_VERSION 1

添加到每个项目。对于真实世界大小的每个项目,很容易忘记一些没有重新编译的小库。

有更多的标志来定义要绑定的版本;它记录在 msdn.microsoft。 com / en-us / library / cc664727%28v = vs.90%29.aspx 。作为上述行的替代方法,您还可以将

#define _BIND_TO_CURRENT_VCLIBS_VERSION 1

将绑定到所有VC库(CRT,MFC,ATL,OpenMP)的最新版本。

然后,检查嵌入的清单的内容。下载XM资源编辑器: www.wilsonc.demon.co.uk/d10resourceeditor。 htm 。打开每个dll和exe在您的解决方案。看看XP主题清单。检查右侧的version属性是否为9.0.30729.1。如果是'9.0.21022',一些静态库会拉入旧版本的清单。

我发现在许多情况下, / em>版本包含在清单中。这意味着一些库使用sp1版本,其他库不使用。

一个伟大的方法来调试哪些库没有设置预处理器指令:临时修改您的平台标头,以便在尝试嵌入旧清单时停止编译。打开C:\Program Files \Microsoft Visual Studio 9.0 \VC\crt\include\crtassem.h。搜索21022字符串。在那个定义中,把一些东西无效(改变'define'到'blehbleh'等等)。这样,当您编译一个其中未设置 _BIND_TO_CURRENT_CRT_VERSION 预处理器标志的项目时,您的编译将停止,您将知道您需要添加或确认

还要确保使用Dependency Walker,这样你就可以知道什么是dll了。最简单的方法是安装一个没有更新的Windows XP拷贝(仅SP2)。这样,您就可以确定SxS文件夹中没有任何内容正在使用,而不是您提供的side-by-side dll。

Since our switch from Visual Studio 6 to Visual Studio 2008, we've been using the MFC90.dll and msvc[pr]90.dlls along with the manifest files in a private side-by-side configuration so as to not worry about versions or installing them to the system.

Pre-SP1, this was working fine (and still works fine on our developer machines). Now that we've done some testing post-SP1 I've been pulling my hair out since yesterday morning.

First off, our NSIS installer script pulls the dlls and manifest files from the redist folder. These were no longer correct, as the app still links to the RTM version.

So I added the define for _BIND_TO_CURRENT_VCLIBS_VERSION=1 to all of our projects so that they will use the SP1 DLLs in the redist folder (or subsequent ones as new service packs come out). It took me hours to find this.

I've double checked the generated manifest files in the intermediate files folder from the compilation, and they correctly list the 9.0.30729.1 SP1 versions. I've double and triple checked depends on a clean machine: it all links to the local dlls with no errors.

Running the app still gets the following error:

The application failed to initialize properly (0xc0150002). Click on OK to terminate the application.

None of the searches I've done on google or microsoft have come up with anything that relates to my specific issues (but there are hits back to 2005 with this error message).

Any one had any similar problem with SP1?

Options:

  • Find the problem and fix it so it works as it should (preferred)
  • Install the redist
  • dig out the old RTM dlls and manifest files and remove the #define to use the current ones. (I've got them in an earlier installer build, since Microsoft blasts them out of your redist folder!)

Edit: I've tried re-building with the define turned off (link to RTM dlls), and that works as long as the RTM dlls are installed in the folder. If the SP1 dlls are dropped in, it gets the following error:

c:\Program Files\...\...\X.exe

This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

Has no-one else had to deal with this issue?

Edit: Just for grins, I downloaded and ran the vcredist_x86.exe for VS2008SP1 on my test machine. It works. With the SP1 DLLs. And my RTM linked app. But NOT in a private side-by-side distribution that worked pre-SP1.

解决方案

I have battled this problem myself last week and consider myself somewhat of an expert now ;)

I'm 99% sure that not all dlls and static libraries were recompiled with the SP1 version. You need to put

#define _BIND_TO_CURRENT_MFC_VERSION 1 #define _BIND_TO_CURRENT_CRT_VERSION 1

into every project you're using. For every project of a real-world size, it's very easy to forget some small lib that wasn't recompiled.

There are more flags that define what versions to bind to; it's documented on msdn.microsoft/en-us/library/cc664727%28v=vs.90%29.aspx . As an alternative to the lines above, you can also put

#define _BIND_TO_CURRENT_VCLIBS_VERSION 1

which will bind to the latest version of all VC libs (CRT, MFC, ATL, OpenMP).

Then, check what the embedded manifest says. Download XM Resource Editor: www.wilsonc.demon.co.uk/d10resourceeditor.htm. Open every dll and exe in your solution. Look under 'XP Theme Manifest'. Check that the 'version' attribute on the right-hand side is '9.0.30729.1'. If it's '9.0.21022', some static library is pulling in the manifest for the old version.

What I found is that in many cases, both versions were included in the manifest. This means that some libraries use the sp1 version and others don't.

A great way to debug which libraries don't have the preprocessor directives set: temporarily modify your platform headers so that compilation stops when it tries to embed the old manifest. Open C:\Program Files\Microsoft Visual Studio 9.0\VC\crt\include\crtassem.h. Search for the '21022' string. In that define, put something invalid (change 'define' to 'blehbleh' or so). This way, when you're compiling a project where the _BIND_TO_CURRENT_CRT_VERSION preprocessor flag is not set, your compilation will stop and you'll know that you need to add them or made sure that it's applied everywhere.

Also make sure to use Dependency Walker so that you know what dlls are being pulled in. It's easiest to install a fresh Windows XP copy with no updates (only SP2) on a virtual machine. This way you know for sure that there is nothing in the SxS folder that is being used instead of the side-by-side dlls that you supplied.

更多推荐

应用程序不与VS 2008 SP1 DLL一起运行,以前的版本与RTM版本一起使用

本文发布于:2023-10-28 02:41:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535272.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本   不与   应用程序   DLL   RTM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!