title: .NET Portability Warning: CA1901 PInvoke Declarations Should Be Portable
body: <p>When I add the following lines into my code </p>
  
  <pre><code>[DllImport("user32.dll")]
  static extern void keybd_event(byte key, byte scan, int flags, int extraInfo);
  </code></pre>
  
  <p>and run a code analysis against <em>Microsoft Basic Correctness Rules</em>, I get a CA1901 warning. 
  Basically, it complains the 4th parameter <strong>int</strong> <em>extraInfo</em> works fine on a 32-bit platform but a 64-bit integer type is expected on 64-bit platform. </p>
  
  <p>When I modified the code into <strong>long</strong> <em>extraInfo</em>, the 64-bit platform requirement is met but the 32-bit platform is expecting a 32-bit integer. </p>
  
  <p>How to solve this dilemma without suppressing the warning?</p>