Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if DLL is COM or .NET?

Tags:

.net

vb6

I have an updater program, the pulled files from server has mixed vb6 dll and .net DLLs in one directory.

How to determine if a dll is a COM one? (so i can invoke regsvr32 to it from the updater program)

like image 801
Hao Avatar asked Jun 10 '10 03:06

Hao


People also ask

Is DLL A COM?

Answers. COM is a component model while DLL is a dynamically linked library (and also the file extension often used for such binaries).


1 Answers

I guess one way to do it would be to try load the file with System.Reflection.Assembly.LoadFile() (more info). If you get a BadImageFormatException, it's not a valid .NET assembly. There's probably a neater way of doing this, but this should work.

like image 95
Daniel Lo Nigro Avatar answered Sep 22 '22 18:09

Daniel Lo Nigro