title: Integrating C# with Prolog - Getting a "System.BadImageFormatException" Exception though the target platform is set to x86
body: <p>I've got a university project involves integrating Prolog with C# , So i downloaded the SwiPlCs DLL and linked it with my project.</p>
  
  <p>I've got the following lines inside <code>Main()</code> method:</p>
  
  <pre><code>Environment.SetEnvironmentVariable("PATH", @"E:\\swipl\\bin");
  string[] p = { "-q", "-f", @"test.pl" };
  PlEngine.Initialize(p);
  </code></pre>
  
  <p>When i run the program , an exception occurs with the following message:</p>
  
  <pre><code>An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
  
  Additional information:  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
  </code></pre>
  
  <p>I spent all the time reading related questions on Stack Overflow , people were suggesting to change the platform target to <code>x86</code> , and that's what i exactly did , but nothing worked and i'm still getting the same exception.</p>
  
  <p>Are there any solution(s) to this problem ?</p>