Come si interpretano i flag CorFlags e come dovrei utilizzarlo per determinare se un assembly .NET è stato creato per x86 o x64?Come interpretare i flag CorFlags?
Potrebbe essere il seguente?
corflags MyAssembly.dll
Come si interpretano i flag CorFlags e come dovrei utilizzarlo per determinare se un assembly .NET è stato creato per x86 o x64?Come interpretare i flag CorFlags?
Potrebbe essere il seguente?
corflags MyAssembly.dll
Aprire il Visual Studio Prompt dei comandi (in Windows: menu Start/Programmi/Microsoft Visual
Studio/Visual Studio Tools/Visual Studio 2010 Prompt dei comandi)
CD nella directory che contiene la DLL in domanda
corflags correre come questo:
corflags MyAssembly.dll
L'output simile a questo:
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 1
ILONLY : 1
32BIT : 0
Signed : 0
L'interpretazione bandiere:
Any CPU: PE = PE32 and 32BIT = 0
x86: PE = PE32 and 32BIT = 1
64-bit: PE = PE32+ and 32BIT = 0
È inoltre possibile utilizzare questa tabella:
CPU | PE | 32BIT ----------|-------|------ x86 | PE32 | 1 Any CPU | PE32 | 0 x64 | PE32+ | 0
Anche in * [Come determinare se un assembly .NET è stato creato per x86 o x64?] (Http://stackoverflow.com/questions/270531/how-to-determine-if-a-net-assembly-was- built-for-x86-or-x64/270545 # 270545) * –
Microsoft .NET 4.5 ha introdotto una nuova opzione, Qualsiasi CPU a 32 bit Preferito. Nella nuova versione di CorFlags.exe, il flag 32BIT non esiste più, sono stati aggiunti due nuovi flag, 32BITREQ e 32BITPREF.
Da qualche parte in base alla spiegazione riportata di seguito, possiamo interpretare il nuovo CorFlags come segue.
CPU Architecture PE 32BITREQ 32BITPREF
------------------------ ----- -------- ---------
x86 (32-bit) PE32 1 0
x64 (64-bit) PE32+ 0 0
Any CPU PE32 0 0
Any CPU 32-Bit Preferred PE32 0 1
Bandiere visualizzati dal CorFlags.exe situato a C: \ Program Files (x86) \ Microsoft SDK \ Windows \ v8.1A \ bin \ netfx 4.5.1 Strumenti
Version : Assembly's target framework. Header : 2.0/2.5 (Must have version of 2.5 or greater to run natively) PE : PE32 (32-bit)/PE32+ (64-bit) CorFlags : Hexadecimal value, computed based on below 4 flags. ILONLY : 1 if MSIL otherwise 0 32BITREQ : 1 if 32-bit x86 only assembly otherwise 0 32BITPREF : 1 if 32-bit x86 only preferred in Any CPU architecture otherwise 0 Signed : 1 if signed with strong name otherwise 0
il seguente esempio illustra l'uscita di C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\CorFlags.exe
per i diversi gruppi.
PresentationCore.dll da GAC_32
CorFlags.exe "C:\Windows\Microsoft.NET\assembly\GAC_32\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll"
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 0xb
ILONLY : 1
32BITREQ : 1
32BITPREF : 0
Signed : 1
System.Data.dll da GAC_64
CorFlags.exe "C:\Windows\Microsoft.NET\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll"
Version : v4.0.30319
CLR Header: 2.5
PE : PE32+
CorFlags : 0x18
ILONLY : 0
32BITREQ : 0
32BITPREF : 0
Signed : 1
sistema.DLL da GAC_MSIL
CorFlags.exe "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll"
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 0x9
ILONLY : 1
32BITREQ : 0
32BITPREF : 0
Signed : 1
Per conoscere Qualunque CPU 32 bit preferiti assiemi riferiscono What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11
Ottimo esempio .. Grazie mille. – Karan
Per aggiungere maggiore dettaglio alle altre risposte, il valore effettivo importante è il CorFlags esadecimali valore poiché contiene la maggior parte delle informazioni. Ecco l'elenco di bit che compongono:
[Flags]
public enum CorFlags
{
ILOnly = 0x00000001,
Requires32Bit = 0x00000002,
ILLibrary = 0x00000004,
StrongNameSigned = 0x00000008,
NativeEntryPoint = 0x00000010,
TrackDebugData = 0x00010000,
Prefers32Bit = 0x00020000,
}
Corflags emette i quattro bit di questo valore separatamente (ILONLY, 32BITREQ, 32BITPREF e sottoscritto). Tuttavia, il valore CorFlags completo contiene anche informazioni sul fatto che l'assembly sia firmato con il nome sicuro o con segno di ritardo (0x8 bit), nonché con i bit ILLibrary, NativeEntryPoint e TrackDebugData (non so cosa significano).
Nota che l'output CorFlags Firmato non è esattamente il bit StrongNameSigned. Stamperà Firmato 1 se l'assemblaggio è firmato a tempo pieno o firmato, mentre il bit StrongNameSigned è impostato se l'assemblaggio è completamente firmato.
Per quanto ne so, 'CorFlags.ILLibrary' è impostato per la versione di immagini nativi degli assiemi. –
La risposta all'indirizzo http://stackoverflow.com/a/23614024/3923734 è più aggiornata di questa. – user145400
Mentre tecnicamente corretto per il suo tempo .... la risposta qui sotto per .NET 4.5 è più preciso/aggiornato. –
Come compilazione "Qualsiasi CPU", l'output Corflags è strano per me PE: PE32 + | 32BIT: 0. è possibile? –