is it Possible to Run a EXE witch is compiled as ANYCPU on an 64 BIT OS, but in 32bit Mode?
is there a way to configure the start mode?
thank you for any advice
is it Possible to Run a EXE witch is compiled as ANYCPU on an 64 BIT OS, but in 32bit Mode?
is there a way to configure the start mode?
thank you for any advice
It is possible if you have compiled your app using the NET Framework 4.5. In this environment you can select the Prefer 32 bit to force your app to run in 32 bit mode also when the underlying OS is 64bit
This is the relevant part of this article:
In .NET 4.5 and Visual Studio 11 the cheese has been moved. The default for most .NET projects is again AnyCPU, but there is more than one meaning to AnyCPU now. There is an additional sub-type of AnyCPU, “Any CPU 32-bit preferred”, which is the new default (overall, there are now five options for the /platform C# compiler switch: x86, Itanium, x64, anycpu, and anycpu32bitpreferred). When using that flavor of AnyCPU, the semantics are the following:
- If the process runs on a 32-bit Windows system, it runs as a 32-bit process. IL is compiled to x86 machine code.
- If the process runs on a 64-bit Windows system, it runs as a 32-bit process. IL is compiled to x86 machine code.
- If the process runs on an ARM Windows system, it runs as a 32-bit process. IL is compiled to ARM machine code.
JIT will take care of this when you say 'AnyCPU', It will load 64-bit libraries when it is loaded into a 64 bit process or 32-bit when it is loaded into a 32-bit process.
Since you haven't specified which version of visual studio are you using, You can edit your project file manually for forcing your app to run on32 bit.
<Reference Include="Filename, ..., processorArchitecture=x86">
<HintPath>C:\..\x86\DLL</HintPath>
</Reference>
and change Platform value in required areas.
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<Reference ...>....</Reference>
</ItemGroup>