posted on Thursday, December 16, 2004 8:22 PM by Knight_Reign

One configuration, multiple packages...

This question comes up a lot.

“Can you use one configuration for multiple packages?“ The answer is yes. In fact, from the start, this was the scenario that we were planning for and ultimately is the way to abstract your packages away from the differences in the machines they are running on. Here's a really simple example that shows how to configure a property on a task, in this case, the subject line of a send mail task in two packages with the same configuration file:

Here's how you do it:

  1. Create two new packages in your solution.
  2. Drop a send mail task into each one
  3. Rename them both, SendMail. I know, not much imagination. Bear with me, it's late.
  4. Change the subject lines for both Send Mail tasks to something random like “On these three breezy trees the cheezy flees flew“
  5. Right click on one of the packages and select configurations.
  6. Create a new XML configuration file and specify the subject property of the SendMail task to export to the configuration.
  7. Save the configuration somewhere.
  8. Go to the other package, right click, select package configurations, browse for the one you've just created and select it.
  9. The wizard will ask you if you want to reuse the existing one. Click on yes.
  10. Now you've got two packages that use the same configuration. So long as both tasks are named the exact same, and they remain in the same location hierarchically (so their package paths match), both will get configured from the same configuration you've created.

This will yield a configuration that should look something like this:

Configuration ConfiguredType="Property" Path="\Package\SendMail.Subject" ValueType="String"

If you try this, let me know how it works for you.

Thanks,

Universe.Earth.Software.Microsoft.SQLServer.IS.KirkHaselden

Comments

# thanks @ Friday, September 16, 2005 10:31 AM

Very interesting blog!

Donny