Programmatically modify a dtsconfig file
Hi,I am still getting used to SSIS 2008 and have an issue that I am trying to address. I have created a SSIS package that picks up values from a dtsconfig file and uses them to run a series of processes. This works successfully.Now I am creating a .net app that will execute this package, however, based on the data selected in the app I need to set the values in the dtsconfig file to meet them. I have chosen not to use a SQL Server table as I could potentially be running this process several times simulatenously and do not want the processes to pick up the wrong data. My view was that if I passed the variables in a dtsconfig file at runtime, if the file changed while the first initiation of the package was running, it would not impact on that process.The problem I have is that I do not know how to modify the dtsconfig file and am interested in any information anyone out there may have in doing this. I really wante to use command line parameters but we know what happenned to them between 2005 and 2008.Thanks in advance, John
September 10th, 2009 10:06am

I am assuming that you are using a XML file insted of a table (as you mentioned that you are not using a table).if so, my question is , you want to modify the config XML file , how many changed do you have? and what typee.g1- you wnat to connectio to a different Source 2- you want to filter different CRITERIA in a SELECT statment ..story short if you are going to have few FIXED changes in in the CONFIG XML File make them as the mentined folder .....C:\ELT\ConfigFolder1\ConfigFileXML.dtsConfigC:\ELT\ConfigFolder2\ConfigFileXML.dtsConfig... With a different setttings in the ConfigFileXML.dtsConfigso when every you are calling the pacakge with your .NET insted of changing the values of the XML file redirect the configuration folder setting while calling the pacakgee.g.IF Flag = 1 Then DTEXEC/FILEC:MainRootETL\PkgETL-SSIS-318_QAQuiz.dtsx/CONFIGFILEC:\ELT\ConfigFolder1\ConfigFileXML.dtsConfigELSE DTEXEC/FILEC:MainRootETL\PkgETL-SSIS-318_QAQuiz.dtsx/CONFIGFILEC:\ELT\ConfigFolder2\ConfigFileXML.dtsConfig Sincerely SH -- Please kindly dont forget to mark the post(s) that answered your question and/or vote for the post(s)
Free Windows Admin Tool Kit Click here and download it now
September 10th, 2009 4:26pm

What I really want is to be able to modify a single dtsconfig file and enter the variable values for the SSIS package. I have considered creating separate files, but this means that if I add additional variable values to the system I will need to create a new dtsconfig file and modify the application code. I do not want to do this as I want it passed through directly as the SSIS package is smart enough to pick up this data and run with it.
September 11th, 2009 3:49am

Since you are creating a .net app to execute the package, you don't need to modify the dtsconfig file to do that work.You could directly call package.processconfiguration(path, value) to change the configuration.Check http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.processconfiguration.aspxfor the detail.
Free Windows Admin Tool Kit Click here and download it now
September 11th, 2009 5:07am

Had a look at that link and I don't understand how this works. It asks for the file location and a typecode. Where do we change or set a value? Or do I create a new xml file. I couldn't google much help on this method.
September 11th, 2009 6:30am

it is not difficult to use that. if you are going to apply the config like - <Configuration ConfiguredType="Property" Path="\Package.Properties[Disable]" ValueType="Boolean"> <ConfiguredValue>0</ConfiguredValue>to the packageYou can do something like Package p = new Package();p.ProcessConfiguration(@"\Package.Properties[Disable]" , "0");It is similar to the "/set" parameter of dtexec.
Free Windows Admin Tool Kit Click here and download it now
September 11th, 2009 7:40am

you have 2 more options- make a frontend .NET program to change the valuesOR- while calling the package pass on the VARIABLE parameter to the pacakge and run the pacakagee.gdeclare @cmd varchar(1000)declare @ssispath varchar(1000)declare @filePath varchar(1000)declare @fileName varchar(1000) set @ssispath = 'C:\temp\Package2.dtsx'set @filePath = 'C:\temp\\'set @fileName = 'test.csv' select @cmd = 'dtexec /F "' + @ssispath + '"'select @cmd = @cmd + ' /SET \Package.Variables[User::filePath].Properties[Value];"' + @filePath + '"'select @cmd = @cmd + ' /SET \Package.Variables[User::fileName].Properties[Value];"' + @fileName + '"' exec master..xp_cmdshell @cmdhttp://www.mssqltips.com/tip.asp?tip=1395Sincerely SH -- Please kindly dont forget to mark the post(s) that answered your question and/or vote for the post(s)
September 11th, 2009 4:32pm

Hi try this specific editor http://dtsconfigexplore.codeplex.com/The complexity resides in the simplicity
Free Windows Admin Tool Kit Click here and download it now
February 11th, 2011 7:04pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics