title: Terminate current SSIS package in C# Script Task without exception/error
body: <p>I'm trying to stop the package execution from within a Script Task. According to <a href="http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.runningpackage.stop.aspx?cs-save-lang=1&amp;cs-lang=vb#code-snippet-2" rel="nofollow">MSDN Article: RunningPackage</a> just <code>RunningPackage.Stop();</code> should work but I get the error <em>"An object reference is required for the non-static field, method, or property Microsoft.SqlServer.Dts.Runtime.RunningPackage.Stop()"</em> this way:</p>
  
  <pre><code>    public void Main() 
      {
          RunningPackage.Stop(); // Object reference error.
      }
  </code></pre>
  
  <p>So i tried the following:</p>
  
  <pre><code>    public void Main() 
      {
          RunningPackage package = new RunningPackage();
          package.Stop();       
      }
  </code></pre>
  
  <p>This way I doesn't get the underlined code as an error, but when saving the edited script SSIS says <em>"Scripts contained in the package have compilation errors"</em>. <code>using Microsoft.SqlServer.Dts.Runtime;</code> was imported.</p>
  
  <p>What's the problem? Is there any other way to stop the current package totally in C# without getting errors?</p>