Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comvisible and "Class not Registered" error

Status
Not open for further replies.

LazyMe

Programmer
Jan 13, 2003
938
MX
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
 
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
{

}
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top