强制.NET互操作以使用本地COM DLL [英] Force .NET interop to use local COM DLL

查看:70
本文介绍了强制.NET互操作以使用本地COM DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以强制互操作程序程序集引用其关联的COM DLL的本地副本?

Is it possible to force an interop assembly to reference a local copy of its associated COM DLL?

这是场景:

我有一个.NET应用程序,它引用一个互操作程序集(Interop.OTAClient.dll),它是COM DLL(OTAClient.dll,它是HP Quality Center的自动化API)的互操作.我对COM不是很了解,但是据我所知,互操作程序集通过注册表中的GUID引用查找COM类,而不是指向特定文件.

I have a .NET app that references an interop assembly (Interop.OTAClient.dll), which is the interop for a COM DLL (OTAClient.dll, which is the automation API for HP Quality Center). I'm not very knowledgable on COM, but as I understand it the interop assembly looks up the COM classes via GUID references in the registry, rather than pointing to a specific file.

我遇到的问题是注册表项指向的OTAClient.dll副本被不同版本覆盖,具体取决于我刚刚在浏览器中登录的QC版本,并且这些DLL的不同版本是彼此不兼容..NET应用程序将仅连接到特定版本的QC,因此我无法以这种方式更改COM DLL.

The issue I have is that the copy of OTAClient.dll that the registry keys point to gets overwritten by different versions depending on which version of QC I've just logged into in a browser, and the different versions of these DLLs are not compatible with each other. The .NET app will only be connecting to a specific version of QC, so I cannot have the COM DLL varying in this way.

任何建议都将不胜感激,因为这种行为确实令人讨厌.我已经看到了有关COM互操作问题的其他问题,但它们似乎都是关于强制使用互操作DLL的本地版本,而不是在GAC中使用它,而不是这种涉及实际COM DLL的特殊情况.

Any suggestions would be greatly appreciated, as this behaviour is really irritating. I've seen other questions on COM interop issues, but they all seem to be about forcing a local version of the interop DLL to be used instead of one in the GAC, rather than this particular scenario involving the actual COM DLL.

推荐答案

您要 查看全文

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