How to read connection strings from a SSIS package not from the config file -


i have requirement like, have read connection string values of ssis package without opening via visual studio.

recently had problem like, connection string hardcoded in ssis packages not reflected in config file. planning have utility connection string packages , compare config files.

but couldn't find way connection strings ssis packages directly.

this approach requires have integration services components installed on machine. instantiate application , package objects, enumerate values in package's connections collection. there, inspect connectionstring object.

this approach not factor in expressions or configurations.

using microsoft.sqlserver.dts;  public static void findconnections() {         string filename = string.empty;         package package = null;         application app = null;          filename = @"c:\sandbox\ssishackandslash2008\ssishackandslash2008\mypackage.dtsx";         package = new package();         app = new application();         app.loadpackage(filename, null);         connections packageconnections = package.connections;         // code approximate         foreach(connection conn in packageconnections)         {             console.writeline(conn.connectionstring);         }  } 

Comments