Deploying .NET COM class library

P

pieter.breed

Hi All,

The company I work for has traditionally used COM/ActiveX for the
solutions that it provides. We are in the process of moving to .NET and
a few applications have been written in VB.NET up to this point.

Some of the applications are class libraries which need to be callable
via the COM interface from some of the older applications. Could
someone please explain to me the issues involved in deploying such a
class library?

On the developer machines it is easy to /deploy/ since you just mark
the project as "Register for COM interop", but what is the equivelant
of this process on a client's machine?

You can assume that we will deploy the .NET runtime.
Friendly Regards
Pieter Breed
 
S

Sujith S. Varier

Hello Pieter,

I didnt got the chance to work with COM-.net interopratbility in a
professional env...But i had spent lil bit of my time with this for the sake
of learning. I think the only thing that we have to make sure is that. the
assemblies and the corresponding type libraries generated from these
assemblies are residing in the same folder, Suppose your assembly is having
a class that contains a method that returns or accepts a type (say a class
residing in another .net assembly), you should create the tlbs for those
types as well, and it should be present at the same folder where these
assemblies are residing.

Nothing esle i can remember at thsi time..
:)

regards
Sujith S.Varier
 
U

UAError

Hi All,

The company I work for has traditionally used COM/ActiveX for the
solutions that it provides. We are in the process of moving to .NET and
a few applications have been written in VB.NET up to this point.

Some of the applications are class libraries which need to be callable
via the COM interface from some of the older applications. Could
someone please explain to me the issues involved in deploying such a
class library?

On the developer machines it is easy to /deploy/ since you just mark
the project as "Register for COM interop", but what is the equivelant
of this process on a client's machine?

You can assume that we will deploy the .NET runtime.
Friendly Regards
Pieter Breed


To make .NET assemblies available to applications that use
COM you need to use this:

NET Framework Tools Assembly Registration Tool (Regasm.exe)
http://msdn.microsoft.com/library/d...ml/cpgrfassemblyregistrationtoolregasmexe.asp

..NET Framework Developer's Guide Registering Assemblies
with COM
http://msdn.microsoft.com/library/d...de/html/cpconregisteringassemblieswithcom.asp


see also
..NET Framework Tools Type Library Exporter (Tlbexp.exe)
http://msdn.microsoft.com/library/d...ls/html/cpgrfTypeLibraryExporterTlbExpexe.asp

You may also have to add some code/attributes to the .NET
code to supply additional COM metadata/functionality.



To have a .NET application access a COM component you create
a Runtime Callable Wrapper (RCW). Visual Studio can do it
for you. However this is the tool to create one
independently:
..NET Framework Tools Type Library Importer (Tlbimp.exe)
http://msdn.microsoft.com/library/d...ls/html/cpgrftypelibraryimportertlbimpexe.asp

For ActiveX components see
NET Framework Tools Windows Forms ActiveX Control Importer
(Aximp.exe)
http://msdn.microsoft.com/library/d...indowsFormsActiveXControlImporterAximpexe.asp


Use Visual Studio .NET only to create the RCW if your
project is the only one that uses that COM library.

If the COM component is used by multiple .NET projects and
was developed in house create a Primary Interop Assembly
(PIA) and include it in a setup merge module.

..NET Framework Developer's Guide Primary Interop Assemblies
http://msdn.microsoft.com/library/d...pguide/html/cpconprimaryinteropassemblies.asp

..NET Framework Developer's Guide Registering Primary Interop
Assemblies
http://msdn.microsoft.com/library/d.../cpconregisteringprimaryinteropassemblies.asp

if the COM library was developed by a vendor, obtain the PIA
from them.



In General

C# Programmer's Reference COM Interop Tutorials
http://msdn.microsoft.com/library/d.../en-us/csref/html/vcoriCOMInteropTutorial.asp

Visual Basic Language Concepts Introduction to COM Interop
http://msdn.microsoft.com/library/d.../en-us/csref/html/vcoriCOMInteropTutorial.asp

Microsoft .NET/COM Migration and Interoperability
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cominterop.asp

..NET Framework Developer's Guide Building .NET Framework
Components for Interoperation
http://msdn.microsoft.com/library/d...ngNETFrameworkComponentsForInteroperation.asp
 

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