Use both versions of DicomObjects in one project

It is possible to use both the COM (ActiveX) version and .NET version of DicomObjects in the same project. The only problem you have to avoid is the conflicting namespace - as in both versions the namespace is the same "DicomObjects".

One solution to solve the namespace conflicts is to use the Type Library Importer (tlbimp.exe) tool which comes with the Microsoft Visual Studio. It converts the type definitions found within the COM version of DicomObjects into equivalent definitions in a CLR assembly, which can then be referenced in the project.


Where to find tlbimp.exe

Wherever you put Visual Studio, you should be able to find the tool in the "..\SDK\v1.1\Bin" or "..\SDK\v2.0\Bin" folder, depends on the .NET framework you are using.

Microsoft Documentations of Tlbimp tool

Microsoft Visual Studio 2005/.NET Framework 2.0 version

The output file

The output of tlbimp tool is an assembly which contains runtime metadata for the types defined in the COM version of DicomObjects, that means you also have to have the DicomObjects referenced in the same project.

You can download a sample output file from here.

Project Reference and Code

Have both versions of DicomObjects referenced in you project:

Reference the new assembly:

In the source code, when you type "Dicom", the IntelliSense will display two different namespace, as shown below. "DicomObjects" is the .NET namespace and the "DicomObjectsCOM" is the COM namespace: