SSIS Deployment: Dev Stage Live AppSettings

2019-09-03 05:25发布

问题:

The main problem is: How do i incorporate an appSettings.Config file with a particular build(dev, stage, live)? My appSettings.Config changes the conx strings for data sources based on which server the package is being deployed to. I am able to go through Package configurations and add my appSettings.Config, however, I can only specifically add one file dev, stage, or live. What i need to do is be able to build the solution and based on teh build type incorporate the dev/stage/live appsettings. How could I do this?

回答1:

You could include all of the configuration files in the install and then just point to the correct one through an environment variable. I know you're wanting to switch the configuration file based on the solution build configuration, but you'll be looking at a complex solution when a simpler alternative exists.

Its quite straight-forward to add registry information during the package install that will set the machine's environment variable under the key:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyVariable

...to the path of the .dtsConfig for the current environment.