I'm developing in Windows 7 64-bit with Visual Studio 2008. I have a collection of class libraries that I merge into a single DLL using ILMerge. When I try to use this merged DLL, however, I get
[BadImageFormatException: Could not load file or assembly 'MyMergedDll' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
I've been searching around for help with this and it looked like I needed to set the Build property in each project in MyMergedDll to target x86, so I did that. I also set all non-MSTest projects in the web service in which I'm referencing MyMergedDll to target x86. I'm still getting this error, however.
If this blog entry is to be believed, I can get this error as a result of doing:
public class SpecificClass: BaseClass: where T : class { }
That is, having a class constraint on a generic. The blog entry is from 2007, though, so I don't know if that still applies. I wanted some input from StackOverflow as to what you guys think the problem is before I go tracking down every generic class in my projects to check constraints.
If it matters, MyMergedDll is strong-name signed. I'm trying to use MyMergedDll in both a console application and in a web service. I don't know if things are perhaps complicated by whether or not IIS is updating every time I rebuild the web service. With the console application, I only seem to get the BadImageFormatException
when I build in Release mode.