title: Call Unmanaged Code from SSIS Script Task
body: <p>I have Business Intelligence -> Integration Services Project where I have SSIS Packages -> Script Task. I need to call from Script Task Unmanaged code using DllImport. Since I don't know where code for Script Task is stored during run-time I can't call my unmanaged dll. </p>
  
  <p>Example code below for Script Task:</p>
  
  <pre><code>using System; // Console
  using System.Runtime.InteropServices; // DllImport
  
  class App
  {
      [DllImport("lib.dll", CallingConvention = CallingConvention.Cdecl)]
  extern static int next(int n);
  
      static void Main()
      {
         Console.WriteLine(next(0));
         Dts.TaskResult = (int)ScriptResults.Success;
      }
  }
  </code></pre>
  
  <p>You can find more about Script Task <a href="https://msdn.microsoft.com/en-us/library/ms345171(v=sql.120).aspx" rel="nofollow">here</a></p>
  
  <p><strong>Question:</strong> How to call Unmanaged Code from SSRS Package -> Script Task?</p>