Hi All,
I'm trying to find a way to programatically (using reflection,
preferably) determine if a given dll is an interop or not?
I've got a system updating program (goes to server, retrieves updates,
and installs them), but I need to be able to register the Interop
files, and for that, I need to be able to identify them. Currently, I
only have one, so I can hardcode it, but it's not exactly a long-term
solution.
-Andy
Andy Franks - 11 Nov 2004 05:49 GMT
OKay, I've found Type.IsCOMObject...but it returns a false on an
interop class. I'm totally confused here.
The Class is declared with ComClass attribute (with all it's various
IDs). The 'Register For COM interop' flag is set in the configuration
manger. The build output says it's registered for COM interop.
So why wouldn't it detect as a COM object? The compiled assembly
appears to be lacking DllRegister and DllUnregister as well, since
regsvr32 doesn't work.
Any help or advise would be vastly appreciated.
-Andy
zabutimaxim@hotmail.com - 14 Dec 2004 14:23 GMT
try to create object from this dll and use
System.Runtime.InteropServices.Marshal.IsComObject()
Robert Simpson - 12 Nov 2004 18:46 GMT
In trying to determine if its an interop DLL or not, are you meaning a .NET
DLL vs. a Native DLL, or a generated (such as what is generated from TLBIMP)
vs. a normal .NET DLL?
> Hi All,
>
[quoted text clipped - 8 lines]
>
> -Andy
Andy Franks - 13 Nov 2004 17:13 GMT
I'm trying to register a .Net DLL with <ComCLass> objects in it. I
did find out that it's still a non-COM DLL, even with the <ComClass>
objects (hence the lack of RegisterDll and UnRegisterDll methods for
RegSvr32 to use).
My test project has the following files and dependencies:
-------------------------------------------------
Filename (Brief description) [Who made it]
-------------------------------------------------
Test.exe (Vb6 executable)[Mine]
ADODB.Interop.dll (.Net Interop wrapper)[Microsoft]
msado15.dll (COM ADO library) [Microsoft](Already installed on the
machine)
CoreLogicInterop.dll (.Net Interop wrapper)[Mine]
CoreLogicInterop.tlb (TypeLib for above)[Mine]
CoreLogic.dll (.Net Library)[Mine]
-------------------------------------------------
After copying it to the client, without attempting any registration I
receive "runtime error 429" when I try to run it.
The only file that Regsvr32 will work on is 'msado15.dll'...and it's
usually already registered anyways.
-Andy
Robert Jordan - 13 Nov 2004 17:18 GMT
Hi Andy,
> I'm trying to register a .Net DLL with <ComCLass> objects in it. I
> did find out that it's still a non-COM DLL, even with the <ComClass>
> objects (hence the lack of RegisterDll and UnRegisterDll methods for
> RegSvr32 to use).
.NET Assemblies are registered with COM using "RegAsm".
bye
Rob