Visual Studio 2005 C# Register for COM Interop option

G

Guest

Hello everyone,


I am using Visual Studio 2005 to develop a C# COM Class Library project.
There is a setting in Build --> Output, called *Register for COM Interop*.
What is the usage of this setting? In my situation, do I need to set this
option?


thanks in advance,
George
 
A

Alberto Poblacion

George said:
I am using Visual Studio 2005 to develop a C# COM Class Library project.
There is a setting in Build --> Output, called *Register for COM Interop*.
What is the usage of this setting? In my situation, do I need to set this
option?

This setting will cause Visual Studio to automatically register your
assembly as a COM component in the Windows Registry when you compile the
project, so that it can be called by a COM consumer. If you don't use this
setting in Visual Studio, you can still generate a COM wrapper and register
your library manually by means of TLBEXP.EXE and REGASM.EXE.
 
G

Guest

Thanks Alberto,


Register you mean the same as regasm <assembly name>? I am wondering what is
the differences between using this Visual Studio 2005 option and do the
following work by myself,

1. regasm /codebase <assembly name>;
2. regasm /tlb <assembly name>.


regards,
George
 
A

Alberto Poblacion

George said:
Register you mean the same as regasm <assembly name>? I am wondering what
is
the differences between using this Visual Studio 2005 option and do the
following work by myself,

1. regasm /codebase <assembly name>;
2. regasm /tlb <assembly name>.

When you use the visual studio option, it does internally something similar
to "regasm <project>.dll /codebase /tlb:<project>.tlb", so it's basically
equivalent to doing steps 1 and 2 manually.
 
G

Guest

Thanks Alberto,


I have made some study as well. I think COM registration operation will be
performed automatically each time after we made a build (if this option is
selected), right?


regards,
George
 
A

Alberto Poblacion

George said:
I have made some study as well. I think COM registration operation will be
performed automatically each time after we made a build (if this option is
selected), right?

Yes, it is. In fact, if you look at the window that displays the
compilation messages, you will see "Registering assembly for COM Interop"
every time you compile.
 
G

Guest

Thanks Alberto,


I may be made a mistake. I have enbaled the option in Visual Studio 2005,
and at the same time, after making a build, I also manually use command
regasm /codebase <assembly name> to register the DLL. Will there be any
issues?


regards,
George
 
A

Alberto Poblacion

George said:
I may be made a mistake. I have enbaled the option in Visual Studio 2005,
and at the same time, after making a build, I also manually use command
regasm /codebase <assembly name> to register the DLL. Will there be any
issues?

There shouldn't be any issues. It is legal to register for a second time
an assembly that has already been registered. This should merely overwrite
the previous registration.
 
G

Guest

Thanks Alberto,


I am wondering how to check what registration entries does Visual Studio
2005 automatically register for me?


regards,
George
 

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