user31673
user31673

Reputation: 13695

.NET version with 64-bit versus 32-bit assemblies

What version of .NET (64-bit vs. 32-bit) will be loaded if some of the assemblies referenced in an app are compiled with 32-bit only (instead of AnyMachine) setting? Will the app still run as 64-bit or will it be forced to run as 32-bit if at least one of the referenced assemblies is compiled as 32-bit only? The app is running .NET 3.5.

Upvotes: 4

Views: 642

Answers (2)

Hans Passant
Hans Passant

Reputation: 942478

The bit-ness is determined by the Platform Target setting on the EXE. There is no mechanism to ensure that a EXE that references a 32-bit only assembly will be forced to run in 32-bit mode as well. The assembly will simply fail to load with a BadImageFormatException.

If your program has a dependency on such a DLL then you must force the Platform Target on your EXE project from AnyCPU to x86.

Upvotes: 4

Gregory Pakosz
Gregory Pakosz

Reputation: 70254

The application will be forced to run as 32-bit

Upvotes: 5

Related Questions