Groups | Blog | Home
all groups > dotnet interop > november 2006 >

dotnet interop : Problems registering C# COM object manually


miikka.laakso NO[at]SPAM kaannos.com
11/23/2006 12:27:07 AM
Whenever I try to use the class (in the normal C++) from the COM object
I get the "Class not registered" error. I have tried to register the
object with commands "regasm.exe MyModule.dll" and "regasm.exe
MyModule.dll /codebase" but neither of them doesn't work.

What is the correct way to register C# COM object class manually?
Jigar Mehta
11/23/2006 6:29:05 AM
Hello,

The correct way to register the C# assembly for interop is,
1. to put the assembly in GAC and register it.
2. to put anywhere other than GAC and register with /codebase option.

For your problem, it seems that you will have to register the assembly
with /tlb option like,
regasm.exe /codebase /tlb <assemblyname>

And import that TLB file while compiling your application.

Let me know if that does not work.

regards,
jigar

[quoted text, click to view]
miikka.laakso NO[at]SPAM kaannos.com
11/24/2006 12:54:20 AM
Hi

I have imported the typelibrary and actually I don't have any problems
with it on my developing machine, but when I try to use it in my
testing machine (x64) it says that the "Class it not registered".

I should have all needed dlls, and all other dlls are registered
properly. My dlls reside on different path than the executable, but
shouldn't codebase attribute solve this?

My dll is not used for general purposes, so it might not be wise to
install it to GAC?


Jigar Mehta kirjoitti:

[quoted text, click to view]
Jigar Mehta
11/24/2006 1:26:55 PM
Hello,

Can you try registering your C# component on deployment box with /tlb option?

=============
Regards,
Jigar Mehta

[quoted text, click to view]

miikka.laakso NO[at]SPAM kaannos.com
11/27/2006 5:19:12 AM
Hi

With the win 32 (development) machine I can register the C# Com object
with command "regasm MyModule.dll /tlb:/my/typelib/path /codebase"
without any problem.

There has been different dll versions of the same module on the test
machine (x64) which might not be unregistered properly. Is there way to
clean registry from these false entries?

Jigar Mehta kirjoitti:

[quoted text, click to view]
Jigar Mehta
11/27/2006 2:27:17 PM
Hello,

Yes, you can use regasm /u <assembly name> OR regasm /unregister <assembly
name> for unregistering the assembly.

=============
Regards,
Jigar Mehta

[quoted text, click to view]

miikka.laakso NO[at]SPAM kaannos.com
11/27/2006 11:23:54 PM
Hi

I unregistered everything and added the assembly to the GAC, still the
problem remains.

Is there some different situations than class is not really registered
that might cause "Class not registered" error message (for example some
needed module is missing etc.)?

Jigar Mehta kirjoitti:

[quoted text, click to view]
Jigar Mehta
11/28/2006 4:36:34 PM
Hello,

If you unregistered and then re-registered, then also the problem persists,
then I think there is possibility that your TLB file (on the development
machine is not lilnked to the latest TLB file..

Can you tell me by which way you are using your TLB file? I mean are you
using relative path to import the TLB file? Sometimes this happens if you
have wrong TLB file referenced in your project. If you can check this and
let me know.

=============
Regards,
Jigar Mehta

[quoted text, click to view]

AddThis Social Bookmark Button