ComVisible

  • Thread starter Thread starter moakley7842
  • Start date Start date
M

moakley7842

I have a COM component written in C# that was built using Visual
Studio 2008. Each time I try to register it I get the following:

regasm.exe MyCOM.dll /tlb:MyCOM.tlb /codebase /v
Microsoft (R) .NET Framework Assembly Registration Utility
2.0.50727.1433
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

Types registered successfully
Type 'A' exported.
Type 'A' exported.
Assembly exported to 'MyCOM.COM.tlb', and the type library was
registered successfully.

As you can see the types exported are wrong. Cannot be accessed from
unmanaged code. Any suggestions on what I can try?
Mike...
 
Actually, no, I cannot see that the types are wrong, though type 'A' does not
seem meaningful. What types did you export for COM, and how did you export
them?
 
Type 'A' is not meaningful. As it was with 1.1 I expected the types
exported to reflect the names of the interface and class that
implements the interface. I am using the regasm argument /
tlb:MyCOM.tlb to export. The original post contains the command
used. I have used tlbexp.exe and received the same output.
Thanks, Mike...
 
I already understood what you did with regasm. What I was trying to ask was
related to your source code how do you export for COM. One method is
checking the box in the project properties to "Register for COM Interop".
The second way would be to attribute the classes desired for COM. Something
like this:

[Guid("some guid")]
public interface IMyInterface
{
void DoSomething();
}

[ProgId("ProjectName.ClassName")]
[Guid("some guid")]
[ClassInterface(ClassInterfaceType.None)]
public MyClass : IMyInterface
{
public void DoSomething()
{
// Implementation here.
}
}
 
This might be a dumb question, but are you using an obfuscator?

Family Tree Mike said:
I already understood what you did with regasm. What I was trying to ask was
related to your source code how do you export for COM. One method is
checking the box in the project properties to "Register for COM Interop".
The second way would be to attribute the classes desired for COM. Something
like this:

[Guid("some guid")]
public interface IMyInterface
{
void DoSomething();
}

[ProgId("ProjectName.ClassName")]
[Guid("some guid")]
[ClassInterface(ClassInterfaceType.None)]
public MyClass : IMyInterface
{
public void DoSomething()
{
// Implementation here.
}
}


Type 'A' is not meaningful. As it was with 1.1 I expected the types
exported to reflect the names of the interface and class that
implements the interface. I am using the regasm argument /
tlb:MyCOM.tlb to export. The original post contains the command
used. I have used tlbexp.exe and received the same output.
Thanks, Mike...
 
Yes I am, but everything public for the interface and class will be
left in clear text. The only public members are methods.


This might be a dumb question, but are you using an obfuscator?



Family Tree Mike said:
I already understood what you did with regasm.  What I was trying to ask was
related to your source code how do you export for COM.  One method is
checking the box in the project properties to "Register for COM Interop".  
The second way would be to attribute the classes desired for COM.  Something
like this:
[Guid("some guid")]
public interface IMyInterface
{
void DoSomething();
}
[ProgId("ProjectName.ClassName")]
[Guid("some guid")]
[ClassInterface(ClassInterfaceType.None)]
public MyClass : IMyInterface
{
public void DoSomething()
{
// Implementation here.
}
}
"(e-mail address removed)" wrote:

- Show quoted text -
 
Thank You for taking the time to reply. Yes I had been using both
method that you suggested. As it turns out it may have been that my
registry was cluttered. I found 2 registered copies, unregistered
both, and then re-registered the current assembly. I am now able to
access it from unmanaged code.
Mike...

I already understood what you did with regasm.  What I was trying to ask was
related to your source code how do you export for COM.  One method is
checking the box in the project properties to "Register for COM Interop". 
The second way would be to attribute the classes desired for COM.  Something
like this:

[Guid("some guid")]
public interface IMyInterface
{
void DoSomething();

}

[ProgId("ProjectName.ClassName")]
[Guid("some guid")]
[ClassInterface(ClassInterfaceType.None)]
public MyClass : IMyInterface
{
public void DoSomething()
{
// Implementation here.



}
}
Type 'A' is not meaningful.  As it was with 1.1 I expected the types
exported to reflect the names of the interface and class that
implements the interface.  I am using the regasm argument /
tlb:MyCOM.tlb to export.  The original post contains the command
used.  I have used tlbexp.exe and received the same output.
Thanks, Mike...

- Show quoted text -
 
Back
Top