This week I jumped on the .NET 4 bandwagon. I had a proof of concept project that I wanted to bring up to the “real product” level. This new product consists of a console application, a windows service, and some business logic and data access assemblies. During the development of my proof I created a small deployment project to build a quick and dirty installer.
I’ve upgraded the solution to 2010. I’ve done all the refactoring and finished my work. Everything tests out great in both unit tests and “developers computer” tests. Just need to get the installer updated and get the pesky “other peoples computers” thing out of the way.
I’ve updated the pre-requisites on my installer to include .NET 4.0 – rebuilt the installer and boom.
Error 1001. Exception occurred while initializing the installation. System.BadImageFormatException: Could not load file or assembly ‘file:///C:\Program Files\Landor\ … \RADE.Connect.Service.exe’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
After much mucking around I found the hidden property that I needed to change. I needed to change the .NET version of the .NET Launch Condition. To find this gem right click on the deployment project in the solution explorer and choose View\Launch Conditions. Next right click on the “.NET Framework” under “Launch Conditions” and choose “properties”. In the properties dialog change the Version to be “.NET Framework 4”.
Don’t forget to edit the .NET version for both Release and Debug configurations.