Current Position:Home > How can apply configure file in ssis by using script task ?

How can apply configure file in ssis by using script task ?

Update:10-11Source: network consolidation
I had  two config file in ssis
 1. config file as per QA
2. config file as per Production
 I think apply dynamically by using script task for above file (acc to server)
How can I apply in script task for config file path in C# script
any one provide Helpful code ??

The Best Answer

I applied script Task  with below code :
public void Main()
Application App = new Application();
Package Pack = new Package();
DTSExecResult pkgResults;
string strPackageName;
string filename = "";
string configvalue;
configvalue = Dts.Variables["Config"].Value.ToString();
strPackageName = Directory.GetCurrentDirectory().ToString() + "\\Excel Reports from Remittance advice\\Child.dtsx";
Pack = App.LoadPackage(strPackageName, null);
if (Pack != null)
if (configvalue == "DEV")
filename = Dts.Variables["Config_QA"].Value.ToString();
else if (configvalue == "PROD")
filename = Dts.Variables["Config_Pd"].Value.ToString();
Dts.TaskResult = (int)ScriptResults.Failure;
System.Windows.Forms.MessageBox.Show("Unable to bind the XML Configurations");
} System.Windows.Forms.MessageBox.Show("Config:"+filename);
Pack.EnableConfigurations = true;
App.SaveToXml(strPackageName, Pack, null)
pkgResults = Pack.Execute(); //Pack.Execute();
System.Windows.Forms.MessageBox.Show("Results:" + pkgResults.ToString());
Dts.TaskResult = (int)ScriptResults.Success;
But ouput in ssis showing as
But some thing missed in code  plz help me ...