How can I determine if a .NET assembly was built for x86 or x64?

后端 未结 15 1159
面向向阳花
面向向阳花 2020-11-22 09:08

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?

15条回答
  •  天命终不由人
    2020-11-22 09:46

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

    dumpbin.exe /HEADERS 
        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 
    

提交回复
热议问题