For Visual Studio 2010, after we upgraded some of the assembly to target .Net Framework 4.0 from .Net Framework 3.5, we could no longer install using the setup project.
The installation error is:
“System.BadImageFormatException: Could not load file or assembly ‘file:///C:\Program Files (x86)\xxxx.exe’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..”
When we build the setup project, we get the following error:
“WARNING: The target version of the .NET Framework in the project does not match the .NET Framework launch condition version ‘3.5.30729 ‘. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).”
1. Right click on the setup project, View –> “Launch Conditions”.
2. Click on “.NET Framework”. It is properly red flag with an exclamation mark and red underline.
3. On the Properties section, change Version from 3.5.30729 to .NET Framework 4.