I have a .NET application that was supposed to be compiled as a 32-bit only application. I suspect my build server isn't actually doing it.
How do I determine if a .NET application is actually set to run in 32-bit mode?
I have a .NET application that was supposed to be compiled as a 32-bit only application. I suspect my build server isn't actually doing it.
How do I determine if a .NET application is actually set to run in 32-bit mode?
To do this at runtime...
You can evaluate
IntPtr.Size
. IfIntPtr.Size == 4
then it's 32 bit (4 x 8). IfIntPtr.Size == 8
then it's 64 bit (8 x 8)The quickest way is probably that it'll have an asterisk (*) after its name in task manager when run on a 64 bit machine. The asterisk means it's running in syswow64, ergo it's marked 32 bit.
The other way is to run corflags.exe against it and this will display the answer you're after. This comes with the .NET SDK.
I use the following code:
With:
You can pass Process.CurrentProcess or similar to this.
If you want to test an assembly non programmatically, you can use corflags.exe
I was searching for the same information and I found that since Windows 8.1, there is no more asterisk.
You have a Task Manager details column named "Platform". Its content is "32 bits" or "64 bits".
If you're trying to check whether or not a running application is running in 32-bit or 64-bit mode, open task manager and check whether or not it has an asterisk (*32) next to the name of the process.
If you have a compiled dll and you want to check if it's compiled for 32-bit or 64-bit mode, do the following (from a related question). I would think that you want you dll to be compiled for AnyCPU.
Open Visual Studio Command Prompt and type "corflags [your assembly]". You'll get something like this:
You're looking at PE and 32BIT specifically.
AnyCpu:
PE: PE32 32BIT: 0
x86:
PE: PE32 32BIT: 1
x64:
PE: PE32+ 32BIT: 0