ComVisible

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...
 
F

Family Tree 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?
 
M

moakley7842

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...
 
F

Family Tree 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.
}
}
 
O

ormico

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...
 
M

moakley7842

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 -
 
M

moakley7842

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 -
 

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