I have a Windows Service, written in C# (.Net Framework 4.8) and installed using an installer built with WixSharp. The service needs to run as 32bit (because it references a COM component which needs to run in 32 bit).
I have tried the following:
- All projects in the solution (the service itself, any helper libraries, and the installer project) have only one configuration, which is 32 bit (x86).
- corflags tells me that the service executable requires 32 bit; I also set that explicitly once more. I.e. I run
corflags.exe /32bitreq+ <myservice.exe>
as well as
corflags.exe <myservice.exe>
which gives me:
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 0x3
ILONLY : 1
32BITREQ : 1
32BITPREF : 0
Signed : 0
But still, when I start the service, it runs as a 64bit process on a 64bit Windows 10 laptop.
Note that all similar questions, e.g. Forcing a .Net Windows service to run as 32-bit on a 64-bit machine and Launching MSIL exe as a 32-bit process on 64-bit Windows , all state you only need to run corflags.exe, but this obviously does not work.
Any idea?