views:

64

answers:

3

Hi all,

I have .net solution (one project written in C++ COM others are written in C#) with its libraries. I would like to make some starttest-tool which would test if all C#, C++ libraries are correctlly registered. How I can do that ? How I can ask .NET if some C# or C++ COM library is regitered ?

br, Milan.

+2  A: 

One way is to create an object using the supposedly registered DLL. if it works then you can be sure its properly registered all other methods may be a bit unreliable

Anders K.
Notice there are various reasons that a registered DLL can't work, the one I met often is missing dependency DLLs
lz_prgmr
Yes that is the most common reason.
Anders K.
A: 

Your best best is to try to instantiate each of the classes your tests require. Resolving references and determining COM registration is somewhat complicated (even for Windows).

For instance, you could search the registry for your COM object's prog id, but this would not tell you that all the dependencies are there and the full object and interfaces are registered properly.

Scott P
A: 

You could scan/search the registry if there is an entry for the classid of the COM component. Or some other key you might set on registration.

All classes are registred in this hive:

HKEY_LOCAL_MACHINE/Software/Classes

Another method would be to try an instantiate the COM object and check if it succeeds or fails.

Mikael Svenson