Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Help calling SSIS package from C#

Help calling SSIS package from C#

Help calling SSIS package from C#

Hi all, I've written a small winForm application to call a SSIS package with a configuration file.

In addition I've added a class EventListener inherited from DefaultEvents to log execution error.

Here you are application code:

string pkgLocation;
Package pkg;
Microsoft.SqlServer.Dts.Runtime.Application app;
DTSExecResult pkgResults;
MyEventListener eventListener = new MyEventListener();
pkgLocation = txtDTX.Text;

app = new Microsoft.SqlServer.Dts.Runtime.Application();
pkg = app.LoadPackage(pkgLocation, eventListener);
pkgResults = pkg.Execute(null, null, eventListener,null,null);

and this is MyEventListener class

public class MyEventListener : DefaultEvents
public override bool OnError(DtsObject source, int errorCode, string subComponent,
string description, string helpFile, int helpContext, string idofInterfaceWithError)
StreamWriter oFile = new StreamWriter(ConfigurationManager.AppSettings["ErrorFile"],true);
oFile.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description);
return false;

Running the application on a Windows Server 2008 R2 (64 bit) machine with SSIS 2012 installed (my code refers to Microsoft.SqlServer.ManagedDTS.dll version 11.0.2100.60)

the package fails and I took the following error on my EventListener: Error in Microsoft.SqlServer.Dts.Runtime.TaskHost/ : The Execute method on the task returned error code 0x80131621 (Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.). The Execute method must succeed, and indicate the result using an "out" parameter.

Can someone help me to investigate the problem?

Perhaps I need to use a different way instead of MyEventListener class?

Thank you in advance for your help.

Best regards


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close