April 15, 2010

Deployment project crashes on execution with .NET version error

Filed under: Development — Tags: — Darrin Maidlow @ 2:47 pm

This week I jumped on the 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”.

Update 4/20/2010

Don’t forget to edit the .NET version for both Release and Debug configurations.

1 Comment »

  1. Just came across this!
    I had exactly the same problem. I think they’re should have been more documentation on this!

    I blogged about it too:

    Comment by Alex Brown — April 26, 2010 @ 4:50 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress

Switch to our mobile site