1

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.

Monic
  • 726
  • 10
  • 31
  • Not sure it would be a duplicate, but this may help: http://stackoverflow.com/questions/25062085/pass-variables-to-project-parameters-in-ssis – Eris May 13 '17 at 19:59
  • I don't want to change the parameters, only use them from project level instead of package level. They are there, I don't need to change them, I just want somehow use them :) – Monic May 14 '17 at 19:02
  • Try this: https://social.technet.microsoft.com/wiki/contents/articles/22194.use-ssis-variables-and-parameters-in-a-script-task.aspx – Jacob H May 15 '17 at 13:18

0 Answers0