Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I love this site! It's so nice to know that there are so many people out there who are willing to share their knowledge..."

Geography

Where in the world do Tek-Tips members come from?
fabjoe (Programmer)
25 May 12 11:48
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);
pkg.ImportConfigurationFile(txtConfig.Text);
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);
oFile.Flush();
oFile.Close();
oFile.Dispose();
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

Fabrizio
ssisjoost (Programmer)
28 Sep 12 11:14
add useLegacyV2RuntimeActivationPolicy="true" to the app.Config


More info http://microsoft-ssis.blogspot.com/2012/09/call-ssis-2012-package-within-net.html

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