Silverlight - C++ dll bad image format exception

297 Views Asked by At

I have a dll that I build from a C++ project. I indirectly reference that dll in a Silverlight project (I mean, the web project refers to a C# project, which in turn uses this dll). Now everytime i build my Silverlight app I get this

    Error   1   The "CreateRiaClientFilesTask" task failed unexpectedly.
System.Web.HttpException (0x80004005): Could not load file or assembly 'MyDll' or one of its dependencies. An attempt was made to load a program with an incorrect format. ---> System.Configuration.ConfigurationErrorsException: Could not load file or assembly 'MyDll' or one of its dependencies. An attempt was made to load a program with an incorrect format. ---> System.BadImageFormatException: Could not load file or assembly 'MyDll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

My silverlight web project refers to other C# projects without any problems. If I remove the reference to C++ dll, everything seems to be fine.

I tired various options two different things

  1. I built the c++ dll in 32 bit and 64 bit, but no change in the error
  2. I changed the .net profile to client version when I build the c++ dll, still no change

(Am on Silverlight 5)

Can someone help me understand what is happening?

Thanks K

0

There are 0 best solutions below