How to determine if a .NET assembly was built for

2018-12-31 14:45发布

I've got an arbitrary list of .NET assemblies.

I need to programmatically check if each DLL was built for x86 (as opposed to x64 or Any CPU). Is this possible?

14条回答
千与千寻千般痛.
2楼-- · 2018-12-31 15:30

I've cloned a super handy tool that adds a context menu entry for assemblies in the windows explorer to show all available info:

Download here: https://github.com/tebjan/AssemblyInformation/releases

enter image description here

查看更多
春风洒进眼中
3楼-- · 2018-12-31 15:31

One more way would be to use dumpbin from the Visual Studio tools on DLL and look for the appropriate output

dumpbin.exe /HEADERS <your dll path>
    FILE HEADER VALUE
                 14C machine (x86)
                   4 number of sections
            5885AC36 time date stamp Mon Jan 23 12:39:42 2017
                   0 file pointer to symbol table
                   0 number of symbols
                  E0 size of optional header
                2102 characteristics
                       Executable
                       32 bit word machine
                       DLL

Note: Above o/p is for 32bit dll

One more useful option with dumpbin.exe is /EXPORTS, It will show you the function exposed by the dll

dumpbin.exe /EXPORTS <PATH OF THE DLL>
查看更多
登录 后发表回答