无法在COM客户端中添加对COM的引用?
创建了一个 COM 服务器并注册了它。
当我尝试在 COM 客户端中添加该 COM 服务器时,我无法添加,并且出现以下错误。
" 无法引用“COMTest” 已添加
ActiveX 类型库 'c\user\~\Debug\COMTest.tlb' 是 从 .NET 程序集导出并可以 未添加作为参考。
添加对 .NET 的引用来代替“
任何人都可以告诉我错误是什么。我以两种方式注册 COM,也从 VS 注册,并且还尝试使用命令提示符。
A COM server is create and I registerd that.
When I am trying to add that COM server in a COM Client, I was not able to add, and following error is comming.
" A reference to 'COMTest' could not
be addedThe ActiveX type Library
'c\user\~\Debug\COMTest.tlb' was
exported from a .NET assembly and can
not added as a reference.Add a reference to .NET instead "
can anybody tell me What is the mistake. I register the COM in both way, from VS also and also tried with command prompt.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一条“你到底为什么要这么做”的信息。项目 + 添加引用,浏览选项卡,选择 DLL,而不是 TLB。因此,您将直接使用 .NET 类,而不是两次通过 COM 互操作。
This is a "why on Earth would you do that" message. Project + Add Reference, Browse tab, select the DLL, not the TLB. So you'll use the .NET class(es) directly instead of going through the COM interop twice.
我假设您指的是.tlb。你应该引用.dll,
并在使用regsvr32注册它之后,你只需要在.net中找到该dll,在com选项卡中添加引用即可。请查看此处 了解更多。
I assume you referring .tlb. you should refer .dll,
And after registering it with regsvr32,You just need to find that dll in .net add reference in com tab. Look here for more.