locked
Best way to determine if a file is a .NET DLL or EXE RRS feed

  • Question

  • I am making a component that parses a .NET dll or EXE reading the manifest and types in it, and I need a good way to determine if the file I'm being passed is a legit .NET DLL or EXE with module(s), manifest, etc, rather than a normal windows DLL or EXE which does not have that information.

    Any ideas?

    Thursday, February 8, 2007 7:36 PM

Answers

  • Just use Assembly.LoadFile and if you catch the FileLoadException, then it's not a .NET file.

    Thursday, February 8, 2007 9:36 PM