现有的COM参考出错或添加了新的COM参考

现有的COM参考出错或添加了新的COM参考

本文介绍了现有的COM参考出错或添加了新的COM参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我以此开头作为开头,说我不熟悉COM引用,并且我在Windows 7 64位计算机上使用VS2010.今天早上,我从TFS撤下了一个现有项目.然后,我尝试构建项目并收到此错误:

Let me preface this by saying that I am unfamiliar with COM references, and I am using VS2010 on a Windows 7 64 bit machine. This morning I pulled down an existing project from TFS. I then tried to build the project and received this error:

我得到这个警告:

当我检查引用时,果然,在解决方案中唯一的COM引用中看到黄色的惊叹号.经过一些毫无结果的测试之后,我决定尝试添加一个新的COM参考.

When I check the references, sure enough, I see the yellow exclamation in the only COM Reference in the solution. After some fruitless testing, I decided to try adding a new COM Reference.

添加参考->"COM"标签->随机M $库

Add Reference -> COM tab -> random M$ library

这将导致一个带有黄色感叹号的新参考.我尝试构建项目以查看是否出现相同的错误.这次我收到此错误:

This results in a new reference with a yellow exclamation. I try building the project to see if I get the same error. This time I receive this error:

我得到这个警告:

我不知道这两个错误是否相关.如果不是这样,那么解决第一个问题肯定要优先于最后一个问题.

I have no idea if these two errors are related. If not, then resolving the first certainly takes precedence over the last.

推荐答案

要检查的另一件事是,您的COM库是否已在Windows的register中注册,您可以这样做:

One other thing to check for is if your COM library is registered in Windows' registery, which can you done like this:

接下来,您需要创建一个互操作的.NET DLL,该DLL环绕您要在C#项目中尝试引用的COM库.完成此操作的方法是运行类型库导入程序实用程序(使用Visual Studio 2010命令提示符):

Next you'll need to create an interop .NET DLL that wraps around the COM library you are trying to reference in your C# project. The way to do this is by running the type library importer utility (use the Visual Studio 2010 command prompt):

对于ADODB参考,您可能需要参考 ADO互操作主要程序集(ADODB).您可以在以下位置的计算机上找到该文件.添加对此的引用,您应该会很好.

As for the ADODB reference, you'll likely need to reference the Primary Interop Assembly for ADO (ADODB). This can be found on your machine at the following location. Add a reference to this and you should be good.

希望以上内容能助您一臂之力.自从我搞砸了COM以来,时间太长了……内存可能有点模糊.享受吧!

Hopefully the above gets you going. Its been too long since I've messed with COM... memory maybe foggy a bit. Enjoy!

这篇关于现有的COM参考出错或添加了新的COM参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 04:26