tags:

views:

18

answers:

1

Hi,

I have to adjust dll to be COM object (one main class in the class library). This dll has reference to other dlls. When i'm using C# attributes for COM and register the dll, i can't work with this class, the registration register a lot of mess in the registry (few public classes in my class library, that i don't want to expose them as com). It drive me crazy this issue, does anyone know whether com interface in C# force changes in the reference dlls (when i'm creating a simple class and interafce it works great, that why i think it is related to the references dlls)? Please help me!!!

Thanks is advance!!!

+1  A: 

use Attibutes in that assembly. if you don't want public classes be visible as COM interfaces

[ComVisible(false)]

then there are some options how to make it COM-visible one of them: make an interface with attributes

 [ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid("new generated GUID")]
public interface ISample
{
 void DoSomthing();
}

then implement this interface

[Guid("new generated GUID")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(ISample))]
[ProgId("YourModule.YourClass")]
[ComVisible(true)]
public class YourClass :  ISample
Arseny
But the class i want to visible as com interface (and i set him as true), does not exist in the registry at all!!Are you sure no changes needed for the referenced dlls?
breakpoint
@breakpoint see my updates
Arseny
Well, i have an interface (ISample) and static class factory (static class SampleFactory) that does not implemnt ISample interface, just has Create function which return ISample instance.I want to expose those class as com visible. is it possible? actually, it is not work :(
breakpoint