1

We have been trying to set up a CI process for SQL server database, and have successful imported the remote (DEV) db into our local database as a VS project. So we are able to make changes to the local db, run unit tests and then commit/push changes to the remote repo. The CI server (TFS) triggers the process on the remote DEV server, making the build and running the unit tests.

Everything is nearly working apart from the connection string to be made before running the test. We are not able to differentiate the app.config file based on the running environment. It is fixed and (it seems) can contain only one reference (local or remote) therefore the connection to the database can only work locally or remotely.

Is there any possible way to adjust the connection string in the app.config on the fly connecting it against local db (on the user laptop) while working locally and using the remote DEV database while the CI process is triggered by the TFS ?

Is it a good practice to use two different files (i.e. local.app.config and remote.app.config) ? if yes, how ? or would you rather change its content based on the running env ? or maybe there is an easier way in VS which I don't truly know!

We really appreciate any advice/suggestion. Thanks!

Chamberlain
  • 881
  • 5
  • 17
user1611183
  • 311
  • 1
  • 5
  • 12
  • perhaps app config transforms can help you here (see [this](http://stackoverflow.com/a/7195232/1791065) answer or [this](http://gunnarpeipman.com/2013/11/using-web-config-transforms-with-app-config-files/) tutorial – Alexandru Marculescu Sep 27 '16 at 08:01

0 Answers0