문제

Can I find whether a .NET assembly has been specifically build for 32 or 64 bits using Mono.Cecil? Or any other way of finding out without having to load the assembly first.

도움이 되었습니까?

해결책

Using mono-ceci, you can do this (the information is available module by module):

AssemblyDefinition asm = AssemblyFactory.GetAssembly("myassembly.dll");

foreach (ModuleDefinition module in asm.Modules)
{
    Console.WriteLine("Module " + module.Name);
    Console.WriteLine("IsPE64 " + module.Image.PEOptionalHeader.StandardFields.IsPE64);
}

다른 팁

moduleDefinition.Architecture is of type TargetArchitecture witch is defined as:

public enum TargetArchitecture {
    I386,
    AMD64,
    IA64,
    ARMv7,
}

There is another property, moduleDefinition.Attributes of type ModuleAttributes:

[Flags]
public enum ModuleAttributes {
    ILOnly = 1,
    Required32Bit = 2,
    StrongNameSigned = 8,
    Preferred32Bit = 0x00020000,
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top