Problem: After converting the window service project to .Net 4.0 Framework, you received an error while deploying with InstallUtil Utility or SetUp Project file. Error Example:
C:\>installutil -i C:\mywindowservice.exe
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Jupi
terMobile\JMServerExternalSystem\JMServerExternalSystem.exe' or one of its depen
dencies. This assembly is built by a runtime newer than the currently loaded run
time and cannot be loaded..
Solution: If you look closer to InstallUtil output, it displays “Microsoft (R) .NET Framework Installation