G
Guest
Hi,
I have a class with some functions that I want to be available via COM
interop. I declared the interface, which the class is based on, like this:
[Guid("F2B5A004-9D1C-4fba-B8BE-D7C6B08618CD")]
public interface IA
{
[DispId(1)]
string Test();
[DispId(2)]
bool SaveChanges();
[DispId(3)]
bool SendResults();
}
Now, I want my class to also implement a second interface which is located
in another assembly (another C# project to which I made a reference in my
current project) that has the following definition:
public interface IB
{
bool UpdateInformation();
}
I don't want any functions or properties from IB to be exported or available
through COM interop. Basically, I then defined my class like this:
[Guid("AAC98A5E-8AA5-49fb-B0D7-EE6E6902D1B8"),
ClassInterface(ClassInterfaceType.None)]
public class MyClass : IA, ExternalNamespace.IB
{ ... }
I made sure to implement every function from both interfaces. Now, when I
try to compile this solution without the "Register for COM interop" set to
true, everything is fine. But if I set the option to true, I get the
following error when compiling my current project (the one with the class
implementing the two interfaces):
COM Interop registration failed. Could not find a type library for assembly
'X'.
'X' is my external project referenced in the current project (it compiles to
a Class Library and does not have anything related to COM interop in it).
Why am I getting this error and how can I have a class inherit two
interfaces with only one enabled for COM interop.
Thanks a lot,
Skip.
I have a class with some functions that I want to be available via COM
interop. I declared the interface, which the class is based on, like this:
[Guid("F2B5A004-9D1C-4fba-B8BE-D7C6B08618CD")]
public interface IA
{
[DispId(1)]
string Test();
[DispId(2)]
bool SaveChanges();
[DispId(3)]
bool SendResults();
}
Now, I want my class to also implement a second interface which is located
in another assembly (another C# project to which I made a reference in my
current project) that has the following definition:
public interface IB
{
bool UpdateInformation();
}
I don't want any functions or properties from IB to be exported or available
through COM interop. Basically, I then defined my class like this:
[Guid("AAC98A5E-8AA5-49fb-B0D7-EE6E6902D1B8"),
ClassInterface(ClassInterfaceType.None)]
public class MyClass : IA, ExternalNamespace.IB
{ ... }
I made sure to implement every function from both interfaces. Now, when I
try to compile this solution without the "Register for COM interop" set to
true, everything is fine. But if I set the option to true, I get the
following error when compiling my current project (the one with the class
implementing the two interfaces):
COM Interop registration failed. Could not find a type library for assembly
'X'.
'X' is my external project referenced in the current project (it compiles to
a Class Library and does not have anything related to COM interop in it).
Why am I getting this error and how can I have a class inherit two
interfaces with only one enabled for COM interop.
Thanks a lot,
Skip.