Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

System.BadImageFormatException in brand new project



 I'm starting an EpiServer CMS 6 R2 project from scratch, so I have created an empty site with database using Deployment Center, then I created an empty web application project in VS 2010 and copied the files from my episerver instalation. I've basically only added the references to Episerver dll files and created a sample masterPage and default.aspx. However when I run the site I get the following error: (I have a swedish windows)

Exception Details: System.BadImageFormatException: Det går inte att läsa in filen eller sammansättningen [PROJECT_NAME] eller ett av dess beroenden. Den här sammansättningen har skapats med ett program av en senare version än det aktuella inlästa programmet och kan därför inte läsas in.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

I've googled and I've tried changing the TargetPlatform to X86 in the project properties, as they sugest even on the msdn forums, but it doesn't help.
Has anybody had this problem before? If so, what could I check/change?

Thanks in advance!


Aug 26, 2011 7:50

I suggest you use AnyCPU as configuration to rule out the x64/x86 problem (with your own assembly at least). Be sure to check the configuration manager as it is possible to have a solution config of AnyCPU while the project config in that solution config is still CPU specific.

That said, the error message seems to point more in the direction of framework version than CPU? Is your project configured for .NET4 while your application pool is ASPNET 2.0?

Aug 26, 2011 8:03

Thank you for your reply!
The application pool was actually configured to use v2.0 of the framework, while the project's settings were set to v4.0, so changing the app pool version solved the problem. But i don't quite understand why it caused an error in this case, 'cause i checked other projects and they use for example v3.5 while the app pool uses v2.0 and all run without problems....
Anyway, thanks again!

Aug 26, 2011 9:38

Microsoft have been criticised for their sometimes very confusing versioning schemes. I don't think this situation is one of the worst cases, but I admit it is still a bit confusing. The .NET framework versions up to 3.5 SP1 use the .NET 2.0 runtime. Basically 3.0 and 3.5 are just expansions of the class library, they are not new versions of the runtime. .NET 4 is both a new framework version and a new runtime, which is why 3.5 to 4.0 makes all the difference.

Aug 26, 2011 9:54

Ok, now i understand, but it is definitely confusing, I agree

Aug 26, 2011 10:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.