An assembly will have a method marked with .entrypoint (the ILAsm equivalent) in the metadata. So, technically, you could scan the methods in the metadata tables for that bit of metadata. That's the "official" answer.
You shouldn't rely on the DLL/EXE extension, as some have suggested, because it's entirely possible (although unlikely) that a DLL will have an .entrypoint method marked--you would have a hard time doing this in C#, but other languages could very well create such a situation. You would obviously be unable to execute it directly from the command-line or Explorer (since the .dll extension isn't considered by XP to be directly executable), but you could do an ExecuteAssembly() on it. (At least, last time I checked you could--been a while.) >From within the managed world, check the EntryPoint property of the Assembly object. If it's non-null, that method is marked as the starting point of being executed (meaning, the CLR considers it an executable assembly). Ted Neward Author, Presenter, Consultant Java, .NET, XML services http://blogs.tedneward.com > -----Original Message----- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [EMAIL PROTECTED] On Behalf Of Jekke Bladt > Sent: Wednesday, January 04, 2006 1:20 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: [ADVANCED-DOTNET] Is this System.Assembly an executable or a > library? > > All-- > > Is there a straightforward way to determine from an Assembly object > whether it is an executable or a library? > > TIA > > --Jekke > > =================================== > This list is hosted by DevelopMentor. http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com