I have a library that is to be registered for COM Interop:
%Windir%\Microsoft.NET\Framework\<version>\regasm MyTest.dll
%Windir%\Microsoft.NET\Framework64\<version>\regasm MyTest.dll
Now before doing so, I only want to find out whether the library is already registered for COM Interop, without changing the system configuration. How can I do so? Also, I want to find out whether other versions of the same library (newer and older) are already registered for COM Interop.
The official regasm manual page does now show any parameter that would only output whether a library is already registered.
You can check the registry programmatically (like any COM server, not only .NET), for example, here is what produces the regasm for a class named net2.Class1
in an assembly named 'net2.dll", that was registered with the /codebase argument:
For a non .NET COM Server, the important part is the default value of the HKCR\CLSID\<your CLSID>\InprocServer32 key
which points to the dll that exposes functions to create the declared COM objects.
For a .NET class, this value must be set to mscoree.dll
(which is part of all .NET installations), and then what's also important is the keys Assembly
and Class
.
Note I have provided an equivalent sample of RegAsm in C# code here: Registering a COM without Admin rights, you can also use it the other way round to determine what are the important keys.