Faqs on asp.net,c#,vb.net and sqlserver2005

this blog covers all the Faqs related to .net technologies like asp.net,vb.net,c#.net,ajax,javascript and sqlserver2005.

Feb 29, 2008

regasm.exe, regsvr32.exe,tlbimp.exe and tlbexp.exe

difference among regasm.exe, regsvr32.exe,tlbimp.exe and tlbexp.exe

The difference between regasm and regsvr32:
regasm.exe is used for registering an assembly so that a com client can access its classes and uses them like a com class.
regasm.exe is used to create COM Callable Wrapper (CCW) around .NET assemblies. .NET managed assemblies(EXEs, DLLs) are different from COM DLLs (which are unmanaged, ie. they interact with the OS directly). So to register an unmanaged DLL we use regsvr32.exe.
But if wehave a managed .NET assembly and we want to use it with COM components to use it as if it were a COM assembly, then we need to use regasm.exe.
Regasm.exe creates a type library as well as registers it whereas tlbexp.exe only creates a CCW but does not register it.
Tlbimp.exe:
Tlbimp.exe (Type Library Importer) is used to create a Runtime Callable Wrapper around a COM component so that the unmanaged COM library can be used in .NET.

When do we use Tlbimp and not regasm or regsvr32?

Tlbexp.exe generates a type library that contains definitions of the types defined in the assembly. Applications such as Visual Basic 6.0 can use the generated type library to bind to the .NET types defined in the assembly.
The entire assembly is converted at once. You cannot use Tlbexp.exe to generate type information for a subset of the types defined in an assembly.
You cannot use Tlbexp.exe to produce a type library from an assembly that was imported using the Type Library Importer (Tlbimp.exe). Instead, you should refer to the original type library that was imported with Tlbimp.exe. You can export a type library from an assembly that references assemblies that were imported using Tlbimp.exe.
Tlbexp.exe generates a type library but does not register it. This is in contrast to the Assembly Registration tool (Regasm.exe), which both generates and registers a type library. To generate and register a type library with COM, use Regasm.exe.
Type Library Importer
Tlbimp.exe performs conversions on an entire type library at one time. You cannot use the tool to generate type information for a subset of the types defined within a single type library.

Happy Programming.

0 Comments:

Post a Comment

<< Home