I want, as in title, to run SSIS package (which is in SSIS project folder) with project params from c# app.
I set a ConnectionString
in expressions as: @[$Project::OutputFilePath] +"report.csv"
.
I have such code to run package from c# windows console app:
public static int ExecutePackage(string packageName)
{
string pkgLocation = @"..\..\..\SSIS_Analyze_data_quality\" + packageName + ".dtsx";
Package pkg;
Application app;
DTSExecResult pkgResults;
app = new Application();
pkg = app.LoadPackage(pkgLocation, null);
pkgResults = pkg.Execute();
if (pkgResults == DTSExecResult.Success)
{
Console.WriteLine("Package ran successfully");
return 1;
}
else
{
Console.WriteLine("Package failed");
return 0;
}
}
// SSIS_Analyze_data_quality - this is the catalog with the SSIS project
But when I run this code the package will failed because it can't see params from project. The error is:
"The variable \"$Project::OutputFilePath\" was not found in the Variables collection. The variable might not exist in the correct scope.\r\n"
So my question is how to set scope of this parameter? To let the c# app see also projects parameters, not only package parameters.