Problem Registering Assembly for COM

M

Matthew Wieder

I have:
"public class B : A"
where A is an interface in a different assembly. When I try and use the
flag "Register for COM" on the properties of B's assembly, I get "COM
Interop registration failed. Could not find a type library for assembly
'A'." when I build. If I use the "Register for COM" flag also on A then
the issue goes away, but I don't want to register A for COM, and I
shouldn't need to since B fully implements A and the user will only be
calling against B. Why is this happening and how do I make B accessible
to COM without registering A?
thanks!
 
J

Jochen Kalmbach

Matthew said:
I have:
"public class B : A"
where A is an interface in a different assembly. When I try and use the
flag "Register for COM" on the properties of B's assembly, I get "COM
Interop registration failed. Could not find a type library for assembly
'A'." when I build. If I use the "Register for COM" flag also on A then
the issue goes away, but I don't want to register A for COM, and I
shouldn't need to since B fully implements A and the user will only be
calling against B. Why is this happening and how do I make B accessible
to COM without registering A?

This happens because you derive from A.
There is no workaround for this situation.
Either you derive from A and then A must be also COM visible or you do NOT
derive from A. Then A need not be COM visible.

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp

Do you need daily reports from your server?
http://sourceforge.net/projects/srvreport/
 
M

Matthew Wieder

If I also register A for use with COM, then I get a very strange result.
When I try to consume B via VBA, only the methods that are not in the
A interface are usable. If I try and call a method on B that is in the
A interface, I get a security exception (I don't get any more
informatino then that :( ). Any thoughts?
thanks.
 
M

Matthew Wieder

A reboot seems to have cleared this up. Thanks!

Matthew said:
If I also register A for use with COM, then I get a very strange result.
When I try to consume B via VBA, only the methods that are not in the A
interface are usable. If I try and call a method on B that is in the A
interface, I get a security exception (I don't get any more informatino
then that :( ). Any thoughts?
thanks.
 
D

Daniel McGloin

As luck would have it we ran into the exact same issue today. Looks
like you can use the [ComVisible(false)] attribute on the interface in
A to fix this problem.
 
M

Matthew Wieder

Thanks for the response. When I apply [ComVisible(false)] to the
interface, all it does is hides the interface fom COM, but I still must
register the assembly that contains that interface. Am I missing something?
thanks.

Daniel said:
As luck would have it we ran into the exact same issue today. Looks
like you can use the [ComVisible(false)] attribute on the interface in
A to fix this problem.

Matthew Wieder said:
I have:
"public class B : A"
where A is an interface in a different assembly. When I try and use the
flag "Register for COM" on the properties of B's assembly, I get "COM
Interop registration failed. Could not find a type library for assembly
'A'." when I build. If I use the "Register for COM" flag also on A then
the issue goes away, but I don't want to register A for COM, and I
shouldn't need to since B fully implements A and the user will only be
calling against B. Why is this happening and how do I make B accessible
to COM without registering A?
thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top