Question

.NET 4.0, Windows 7, VS 2010:

Trying to install 64-bit service using the Setup Project leads to Error 1001. Exception occurred while initializing the installation: System.BadImageFormatException.

The Setup Project was created using this. I also set Target Platform to 64bit as instructed here.

If I switch the service's platform to 32bit, everything works fine.

Do you know how to resolve this System.BadImageFormatException exception?

Was it helpful?

Solution

If the target platform of the installer is correctly set, then the only remaining thing will be if the service project itself is targetting x86.

Add a new Solution Configuration for 'Any CPU' (or x64 - since a .Net application as Any CPU will run as 64 bit on a 64 bit machine) if you don't already have one, creating project configuration(s) as well.

Check that the target platform of the exe is 'Any CPU' (or x64) on the 'Build' tab of the project properties (it's about 4 lines down on the property page).

OTHER TIPS

Set the target platform of your project to AnyCPU but you have to uncheck the prefer 32-bits. Then set the installer project setup targePlatform to x64 and then build the project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top