title: Errors trying to load an assembly in C#
body: <p>Ok this question is more about understanding what the issues are as I dont think anyone will be able to tell me how to fix the problem. </p>
  
  <p>I am writing a .net 4 application and I have a 3rd party dll ( hasp dongle protection ) that I want to reference. </p>
  
  <p>Visual studio allows me to create the reference fine and use classes contained within the dll within my code. </p>
  
  <p>The first issue occurs when the program is run and the dll is actually loaded. I then get the following error. </p>
  
  <blockquote>
    <p>System.BadImageFormatException: Could not load file or assembly
    'hasp_net_windows.dll' or one of its dependencies.  is not a valid
    Win32 application</p>
  </blockquote>
  
  <p>This <a href="http://devcrackers.blogspot.com/2011/06/badformatexception.html" rel="nofollow">weblink </a> states how to fix this error. Coud someone expalain what the issue is and why im getting it. </p>
  
  <p>After following this advice I then set the main project build to x86 and I then get another error replacing the other. The new error is:</p>
  
  <blockquote>
    <p>System.IO.FileLoadException: Mixed mode assembly is built against
    version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0
    runtime without additional configuration information</p>
  </blockquote>
  
  <p>This <a href="http://social.msdn.microsoft.com/Forums/en-IE/vcgeneral/thread/5d1186ec-ad55-4929-b1e4-8806cdc758af" rel="nofollow">weblink</a> states how to fix the error, but I dont have an app.config in my project and want to avoid having one if at all possible. If someone could explain what the issue is again that would be helpful?</p>
  
  <p>Please let me know if you require anymore information. </p>