×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Comvisible and "Class not Registered" error

Comvisible and "Class not Registered" error

Comvisible and "Class not Registered" error

(OP)
Hi,

I've created a C# executable with one class being comvisible. I've executed regasm on the excutable and got a valid typelibrary and also the registry settings seem to have been correctly entered. Still, I can't create an object out of the excutable. VB gives me the well-known "activeX can't create object" and C++ gives me a more meaningfull error "Class not registered". However, looking at the registry, the class seems to be registered ok.

A little code from the C# module:

CODE

    [ComVisible(true), Guid("D34A49B5-EB34-11DC-A791-005056C00008"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IContextMenuAccept
{
some stuff
}

CODE

    [ComVisible(true), Guid("D34A49B4-EB34-11DC-A791-005056C00008"), ClassInterface(ClassInterfaceType.None)]
    public class CContextMenuAccept : IContextMenuAccept
{
more stuff
}

The registry entry in HKEY_CLASSES_ROOT\CLSID:

{D34A49B4-EB34-11DC-A791-005056C00008}
  Implemented Catgories
    {62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}
  InprocServer32     default: mscoree.dll
                     assembly: IIS7Admin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=80268d5306b8140e
                     class: LangSoftDev.IIS7Admin.Components.CContextMenuAccept
                     RuntimeVersion: v2.0.50727
                     Threadingmodel: both
    1.0.0.0          Assembly, class and runtime again
  ProgID             default: LangSoftDev.IIS7Admin.Components.CContextMenuAccept



RegAsm did not add a typelib entry under the CLSID section, but I added that myself, with no luck of course...

And, given that nowhere in the InprocServer32 key, there's a reference to the physical location of the assembly, I figured I'd gacutil-it into the global assembly cache. No luck there either....

I'm not unfamiliar with COM; know my way around the COM registry rather well, but I'm a complete newbie on COM-ming from a .net executable and I'm probably overlooking something really simple, but it is driving me mad......

Thanks in avance,
Rick

    

Greetings,  
Rick

RE: Comvisible and "Class not Registered" error

In Project Properties, did you check "Register for COM Interop" in the Build section?

I have a COM interop assembly I just deployed. This is how I declaratively specified various COM-related attributes.  Did you use the /codebase switch when you ran regasm?

[GuidAttribute("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E"),
    ClassInterfaceAttribute(ClassInterfaceType.None),
    ComSourceInterfaces(typeof(IEncrypt_events))]
    [ProgIdAttribute("EncryptLib.Encrypt")]
    public class Encrypt:IEncrypt
    {

    }

RE: Comvisible and "Class not Registered" error

(OP)
HI thanks for your response.

Yes I re-regeasm-ed with the /codebase attribute. I have the path in the registry now, which sould allow me to remove the assembly from the cache. However, it did not solve my problem.

But no, I did not check the Register for COM interop. I figured regasm would take care of that. The project needs to be a class library for that. But that's my problem; it needs to be an exectuble that can run on its own. Something (I think) in VB would be an active exe project. You can fire it up by yourself or someone else can fire it up by requesting a COM object from it. CAn this even be done in .NET? Or would I have to create the server in VB or C++ or some other COM aware language?

Thanks,
Rick

Greetings,  
Rick

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close