Can not add reference a COM in COM client?

谁都会走 提交于 2020-01-10 02:34:30

问题


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 added

The 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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4614625/can-not-add-reference-a-com-in-com-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!