windows-servicesinstallutilmanagedinstallerclass

Installing Windows Service via ManagedInstaller - how to install 64-bit service?


I was going to post this, but managed to dig up the answer, so here it is in case anyone else is looking...

My app installs a windows service via:

string[] installargs = new string[] { binaryname };
ManagedInstallerClass.InstallHelper(installargs);

However on a 64-bit platform I want to force the installation to use the 64-bit installer (the equivalent of the Framework64/InstallUtil)

How do I get ManagedInstallerClass.InstallHelper to run the 64-bit version?


Solution

  • Answer: The framework uses the specific installer for the build you are targetting. ie. if you have built an x64 framework and run on a 64-bit OS, it will use the Framework64/InstallUtil. If you have targetted a 32-bit or Any CPU build and run on a either 32-bit or 64-bit OS it will use the Framework/InstallUtil.

    Note: a 32-bit build installed on a 64-bit OS will still use the Framework/InstallUtil. there is no workaround - you cant have a 32-bit installer install a 64-bit service. You have to build a separate x64 installer if you need to install a 64-bit service.

    Source - Microsoft Forums.