Maxim Maxim - 1 month ago 8
C# Question

SSIS package fails with only OnPreValidate in logs when run from a .NET app

I've created a SSIS package which runs smoothly when launched from SQL Server Data Tools (I use SSDT 2015 with SQL Server 2005 Developer Edition on my PC), but fails with only the following line in logs when I run it from a .NET app:

Fields: event,computer,operator,source,sourceid,executionid,starttime,endtime,datacode,databytes,message
OnPreValidate,<my_computer>,<my_operator>,Test,{E7D40776-05B7-4D1D-8D78-8C87E722E596},{755AD039-B5B4-42B0-9ECA-E396054DEB2F},28.10.2016 14:44:06,28.10.2016 14:44:06,0,0x,


I use the following code to call the package from my .NET app (I just copied the SSIS package in the .NET project from SSIS project and specified it to be copied to the output directory so I could call it from the file system):

public void Execute(string filePath, DateTime period)
{
var pkg = app.LoadPackage(filePath, null);
var variables = pkg.Variables;
variables["Period"].Value = period;
var pkgResults = pkg.Execute(null, variables, null, null, null);
}


The only link relevant to my problem I could find is https://social.msdn.microsoft.com/Forums/sqlserver/en-US/75e4d6fc-3b6f-4ca1-bf12-e823076325cd/package-fails-after-onprevalidate-but-not-in-bids?forum=sqlintegrationservices
I've tried switching package protection level to
DontSaveSensitiveData
, but it didn't help.

What am I doing wrong? Is there a way to at least get some proper data about why the package is failing?

Answer

Solved, the problem. Turned out that:

  1. SSDT 2015 can not be used for developing packages for SSIS 2005 (only for SSIS 2012 and higher).

  2. I somehow had a wrong version of Microsoft.SqlServer.ManagedDTS DLL referenced in my project (the one for SSIS 2014). I've referenced the DLL for SSIS 2005 and everything works fine.