title: Silverlight - C++ dll bad image format exception
body: <p>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</p>
  
  <pre><code>    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. ---&gt; 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. ---&gt; 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.
  </code></pre>
  
  <p>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. </p>
  
  <p>I tired various options two different things</p>
  
  <ol>
  <li>I built the c++ dll in 32 bit and 64 bit, but no change in the error</li>
  <li>I changed the .net profile to client version when I build the c++ dll, still no change</li>
  </ol>
  
  <p>(Am on Silverlight 5)</p>
  
  <p>Can someone help me understand what is happening?</p>
  
  <p>Thanks
  K</p>