.net64-bit.net-1.1visual-studio-2003corflags

How do you make a .NET executable run as a 32-bit process on a 64-bit OS?


I want to make my .NET application run as a 32-bit process on a 64-bit machine with .NET1.1. The target platform option was introduced in later versions of VS(2005), but I am using VS2003 and .NET1.1 and don't have an opportunity to use other VS or .Net

Is this possible?

P.S. I don't know if this is relevant, but a colleague of mine said I should use "cor flags" or "core flags" but googling it didn't come up with any interesting results


Solution

  • You don't have to do anything. .NET 1.1 doesn't have any support for running managed code in 64-bit mode. That didn't become available until .NET 2.0. Any EXE assembly compiled with VS2003 will ask for the 1.1 version of the CLR, it automatically runs managed code in 32-bit mode.

    Similarly, you won't have the Corflags.exe utility either. It originally shipped with the .NET 2.0 SDK, nowadays with the Windows SDK. Visual Studio 2005 and up lets you set the option bit in the cor header that Corflags.exe manipulates by letting you select the "Platform target" in the project options.

    Do watch out for 64-bit machines that don't have .NET 1.1 installed. They'll run your app with the version 2 CLR and that is going to run in 64-bit mode. UAC as implemented in Vista and up can also cause trouble, your EXE won't have a manifest and Windows is going to treat it like a legacy program. Which can be very hard to diagnose when that doesn't work out well. And VS2003 is unsupported on operating systems past XP. There is a defect list, most of them are debugging problems. Keeping your tools updated with your customer's operating system capabilities is rather important btw, 8 years is a long time in dog years and software tools.