— Clayton
Hi Clayton. There are a couple of ways to force your .NET application to run in 64-bit mode:
Build a 64-Bit .NET Version
If you use Microsoft’s Visual Studio, the build configuration is likely be set to Any CPU (the default):
This will produce an executable that will run in either 32-bit or 64-bit mode, depending on the version of .NET available.
To run your executable in 64-bit only, change the configuration to x64 and rebuild.
If your project doesn’t have a x64 configuration, create one like this:
Select Build > Configuration Manager…
In the Configuration Manager,
click the Active solution platform entry and select <New> from the menu that appears:
In the New Solution Platform window, choose x64 in the top box. We recommend copying settings from Any CPU and creating new project platforms (the default):
Click the OK button to record your changes. Close the Configuration Manager
You should now have x64 as a build option. Set it and recompile to produce a 64-bit only executable:
Use CorFlags to Force .NET 64-Bit
If your application is built with “Any CPU” but you can’t rebuild it in Visual Studio, Microsoft’s free CorFlags utility will come to the rescue.
Corflags.exe is distributed with the Windows 10 SDK. Be sure to select the “.NET Development Tools” component when installing.
We actually found the CorFlags exe file in a couple of places on our hard drive:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\Corflags.exe
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\Corflags.exe
You may find CorFlags in older .NET SDK installations as well — it has been around since the release of .NET 2.0 (2005).
Once you have located CorFlags:
Make a copy of the executable you want to run in 64-bit. The application we used for testing is called SystemInfoDotNet.exe, so we copied it to SystemInfoDotNet64.exe.
Open a command prompt with admin rights.
CD to the folder containing the copied application.
Run CorFlags on the copied application file. Specify the /32BIT- option to strip away the ability to run in 32-bit mode:
The copied executable will always run in 64-bit mode.
For example, our SystemInfoDotNet utility — which displays basic process and system information — normally runs in 32-bit mode:
But after running CorFlags on SystemInfoDotNet64, it magically runs in 64-bit mode:
Best of luck with your .NET application Clayton!
MY .dll is 32 my console application works on windows 10 but fails on server 2012 r2.
Sorry to hear that Mangala!
How does it fail on Server 2012? Is there an error message?