可以在同一个应用程序中加载不同版本的DLL吗? [英] Can different versions of DLL be loaded in same application?

查看:793
本文介绍了可以在同一个应用程序中加载不同版本的DLL吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用一个版本的库(a.dll),我使用另一个DLL(b.dll),这反过来又使用我使用的旧版本的相同的库(a.dll)。我通过嵌入清单文件来构建应用程序。我使用的DLL也使用嵌入的清单文件。我有两个版本的库在我的WinSXS文件夹。我的应用程序无法加载适当版本的DLL。

My application uses one version of library (a.dll), I am using another DLL(b.dll) which in-turn uses older version of the same library (a.dll) that i use. I am building the application by embedding a manifest file. The DLL i use is also using a embedded manifest file. I am having both the versions of the library in my WinSXS folder. My application is not able to load the appropriate versions of DLLs.

有一个单独的清单文件(不嵌入到DLL)有助于解决问题吗?有什么工作?

Will having a separate manifest file (not embedding into DLL) help resolving the problem? What is the work around?

推荐答案

您的情况正是WinSxS应该解决的情况。

Your situation is exactly the situation WinSxS is supposed to solve. It should be working.

要么:清单文件指向相同的版本,要么其中一个清单文件未正确嵌入,或

Either: The manifest files are pointing to the same version, or one of the manifest files is not embedded properly, or

WinSxS中的共享程序集安装了一个配置策略,自动将v1.0到v1.1的请求重定向

The shared assembly in WinSxS was installed with a configuration policy that automatically redirects requests for v1.0 to v1.1

需要进行一些澄清:App.exe和b.dll被隐式链接到a.dll?

Some clarifications are needed: App.exe and b.dll are implicitly linked against a.dll? Or do they load it via LoadLibrary.

如果B.DLL使用LoadLibrary显式加载A.DLL,则需要向预处理器定义添加ISOLATION_AWARE_ENABLED,以确保LoadLibrary B.DLL进行的调用查看正确的激活上下文。否则,它们将在由EXE的清单创建的默认激活上下文的上下文中。

If B.DLL loads A.DLL explicitly using LoadLibrary then you need to add ISOLATION_AWARE_ENABLED to your pre-processor definitions to ensure that LoadLibrary calls made by B.DLL look in the correct activation context. Otherwise they will be made in the context of the default activation context which was created by the EXE's manifest.

这篇关于可以在同一个应用程序中加载不同版本的DLL吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆