Thursday, April 2, 2009

VS2008 Woes - An attempt was made to load a program with an incorrect format.

April 02, 2009 Posted by Jason Irwin , , 1 comment

Having recently re-imaged my PC, I attempted to load up a Visual Studio 2008 project that I haven’t touched since the build. It is a simple ASP.NET solution with three sub-projects. Attempting to build the application I received the following error:

Could not load file or assembly MyAssembly or one of its dependencies. An attempt was made to load a program with an incorrect format.

This one took me by surprise and the provided stack trace was of no use. Performing a quick google I came across the following post on Mark’s Blog of Random Thoughts:

Platform type observations..

The post pointed at the platform type (said so in the name) and issues with building for x86 VS. x64. It didn’t make sense in my context – I am using the exact same PC, exact same OS, exact same platform… - but I figured it was my only lead and, for each project in my solution set the Platform target to x86. Lo and behold, I’m back in business.

1 comments: