0

I looked on StackOverflow, but did not see a posted question/solution for this (but maybe missed).

I am looking for a way to test my COM server that is created in C# (i.e. registered for COM interop). When I try and add a reference to the COM object in a different C# project I get the error "...COMTest.tld was exported from a .NET assembly and cannot be added as a reference." I tried from VB and, of course, the same error. The references for the new projects in C# and VB were done from the COM tab after selecting Add Reference when right clicking on the solutions. Finally, I went to Visual C++, but did not see a way to add the reference and access COMTest.

Thanks for looking and any help! Feel free to let me know if any clarification is needed.

Buck
  • 599
  • 7
  • 20
  • 1
    Try reading this http://stackoverflow.com/questions/8619166/calling-managed-c-sharp-com-objects-from-c-sharp – Leon Newswanger Dec 02 '13 at 01:00
  • 2
    Also take a look at this one http://stackoverflow.com/questions/4614625/can-not-add-reference-a-com-in-com-client and let me know if either of these help – Leon Newswanger Dec 02 '13 at 01:03
  • Unfortunately, I have a hard requirement to provide a COM interface/server that will work with other languages. I now have what I think is a working COM server but no way to test it as a client. I read at least one of the posts prior, but due to this requirement both posts/threads did not help (but perhaps I am missing something). Thanks for the reference and help! – Buck Dec 02 '13 at 16:44
  • Alright, do you know exactly which languages you'll be using to access the interface? – Leon Newswanger Dec 02 '13 at 21:51
  • 2
    It is just not meaningful to test from a managed program, you won't actually test the COM interop built into the CLR. It won't create the CCW when it recognizes that the code is called from a managed client. This should just not be an issue, the point was to make it usable from other languages. So use it from another language and write your test in such a language. – Hans Passant Dec 02 '13 at 21:53
  • 1
    Thanks for the responses! I would take any language simple COM client project - any available? No specific language requirement since suppose to be generic COM. That is too bad it is not meaningful to use a managed program through the COM interop. I need it for testing. I would rather not learn another language/development environment just for this. The .NET projects support COM, but they appear to have chosen to block this case for efficiency reasons - prevention of going through another layer? It appears this block could have just been a warning? Thanks again - great info! – Buck Dec 03 '13 at 07:32

0 Answers0