Running .NET programs under Windows PE

Windows PE can be modified to include PowerShell as well as .NET like described here:


Windows PE is limited to running one type of executable (either x86, AMD64 or ARM), depending on the type of Windows PE image.

This also affects .NET applications.


.NET programs compiled for any CPU may fail on AMD64 versions of Windows PE with:

The subsystem needed to support the image type is not present.


This can happen if the “Prefer 32-bit” build option is set, which is the default for some project types with Visual Studio 2015.


The solution is either to remove the “Prefer 32-bit” option before compiling.



Or using corflags to remove any 32-bit flags with:

corflags program.exe /32BITREQ- /32BITPREF-

Running 32-bit or 64-bit IIS Express

IIS Express runs x86 / 32-bit as standard, but there is also a 64-bit version.


The version used for all web projects can be configured in Visual Studio 2013 or 2015 in the Tools -> Options… dialog.

Under: Project and Solutions -> Web Projects

The setting is:  Use the 64 bit version of IIS Express for web sites and projects



I encountered this while trying to debug some startup and initialization issues with IIS Express and Visual Studio.

The result from:


Was the path: C:\Program Files (x86)

But I was expecting the path: C:\Program Files

This was a clear sign that IIS Express was running as x86 / 32-bit.


Found the Visual Studio setting here:

Other possible solutions are to modify the registry or calling the desired version of IIS Express with a script.