This is a mirror of official site: http://jasper-net.blogspot.com/

ResGen.exe error: An attempt was made to load a program with an incorrect format

| Sunday, June 20, 2010
Recently, we’ve seen a number of people reporting problems with resource generation in Visual Studio 2010, particularly when they target .NET Framework 3.5 on 64-bit machines.  In this blog post, I will highlight one of the most common errors; when and where it occurs, and how to work around it.  In a later post, we’ll take a look at some other somewhat less common errors, and some background on the differences between the GenerateResource of VS 2008 and that of VS 2010.

Sample error:

ResourceForm.resx(1436,5): error RG0000: Could not load file or assembly 'file:///C:/Users/sjoiner/Desktop/TestForm/ResTest/bin/x86/Debug/Foo.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 1436, position 5.

Circumstances under which this error is found:

All of the below conditions must be met:

64-bit operating system
Project that contains resource files (Project A)
Assembly that is referenced by project A (Assembly B). This can be either a third-party assembly, or another project in your solution that is referenced via a project-to-project reference
One or more of Project A’s resources files use types from Assembly B.  For example, if Project A is a form and Assembly B contains controls used by that form.
One of the ‘X’-marked combinations of configuration below must be true.  Note: Building using the Visual Studio IDE is equivalent to building using 32-bit MSBuild.exe.

Read more: The Visual Studio Blog

Posted via email from .NET Info

0 comments: