0

I have a .NET solution with several .NET Framework projects inside, two of which generate executables (one is a Windows Service, the other is a WPF app).

Both of those projects target the "Any CPU" platform and do NOT have the "prefer 32bit" flag switched on in the build options.

However, I noticed through the task manager that while the WPF app starts by default in 64bit mode, the service starts in 32bit mode instead.

My question is: why the difference? What determines if a .NET executable that doesn't target a specific platform starts in 32 or 64 bit mode? Is it because it is a Windows Service specifically?

EDIT: re-opening, because the linked supposed "duplicate" question doesn't actually explain why a service would start in 32bit mode on a 64bit machine.

Master_T
  • 7,232
  • 11
  • 72
  • 144

1 Answers1

0

Thanks to @canton7 for pointing me in the right direction.

Turns out that the "prefer 32bit" flag was still active, even if I disabled it from visual studio. Probably a caching issue, I closed visual studio, deleted the bin folders, reopened and rebuilt the solution, the service now correctly starts in 64bit mode.

Master_T
  • 7,232
  • 11
  • 72
  • 144