3

I have a project on VS2015 that was working well. However it's installer was written with the InstallShield addon.

I now need to maintain the project on VS2017, which has a different installer project.

Now I am getting a BadImageFormatException when it tries to install the windows service.

My research so far points to this being due to my service being 64bit, and the installer using a 32bit version of installutil.exe.

My question is how do I change the project to use the 64bit version of this file?

The method I have used to write the installer and service are detailed here.. How to create a setup project for a Windows Service application in Visual C#

I have made sure that my build config is 64bit, and the installer targets a 64bit system.

My question is not really a duplicate, as I am asking how to fix it (which isn't answered in the other questions).

To replicate the issue.. if you follow the instructions in ... How to create a setup project for a Windows Service application in Visual C#

It will compile and work. If you then change the active config to 64bit, and set the targetplatform to 64bit in the properties of the installer project; it will compile fine, and give you a setup.exe and .msi. However these will not install due to the bad image format exception.

My question is how do I change the project so that it works?

Hoping someone can help.

Peterp
  • 100
  • 13
Peter Page
  • 97
  • 3
  • 12
  • So the installer doesn't run anywhere or is this badimageexception only happening on certain systems? – rene Aug 22 '17 at 11:40
  • You might want to enable fusion logging: https://learn.microsoft.com/en-us/dotnet/framework/tools/fuslogvw-exe-assembly-binding-log-viewer to see what gets loaded. Assuming it gets that far. – rene Aug 22 '17 at 11:44
  • The real answer is [here](https://stackoverflow.com/a/19542286/366904). You need to make sure that you're using the 64-bit version of InstallUtil.exe to install your service. – Cody Gray - on strike Aug 22 '17 at 11:47
  • I have seen most of these questions, and answers. Hence my pointing out that my research had shown it was probably to do with installutil.exe being the 32bit version. However what I can't work out is HOW to change the installer project to install a 64bit service. The tutorial I followed is "How to create a setup project for a Windows Service application in Visual C#", which works fine for 32bit services, but not 64 bit ones. – Peter Page Aug 22 '17 at 12:12
  • I don't have a VS2017 installed right now but what does the setup look like? is that an msi? something else you run? – rene Aug 22 '17 at 12:16
  • Apparently in the setup project type supplied for Visual Studio 2017 regardless of the type of the project (64 or 32bit) they include ONLY the 32 bit installer for services. There is a work around apparently using ORCA to edit the MSI and inject the 64 bit installer, but it is complex. Looks like I will have to dig out my old copy of vs2015 and ditch 2017. – Peterp Sep 27 '17 at 13:10

0 Answers0