One of my coworkers has just asked me for help: a setup bootstrapper I’ve implemented some time ago (and now it is reused in about six different setups) wrongly reports the operating system service pack level.

She did some digging and she was able to discover that the issue occurs when setup.exe is run in compatibility mode.

After some discussion, one scenario occurred to me:

  • user downloads an installer for application A, named setup.exe, to Desktop
  • this installer cannot run on Windows 7 unless it is set in Vista compatibility mode
  • the user configures this installer to run in compatibility mode (this data is stored in registry, as a path, without storing the hash of the setup.exe file)
  • user runs setup.exe and then he deletes it; compatibility data stays in registry
  • user downloads our bootstrapper, named setup,.exe, to Desktop
  • user launches setup.exe, Windows detects there are compatibility settings saved for this file and it configures it to run accordingly
  • the bootstrapper reports Windows needs a service pack and it refuses to install

The workaround is to launch the main MSI package independently.

To fix this issue, check the registry key HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers. Delete the path to your executable if it exists.