0

I'm sure this sounds familiar: An application is in production and connects to a live database. Meanwhile, the next version of that application is used by developers (their own executables and a development database) and testers (test executables and a test database).

In EF6, the connection string is either specified in app.config or passed in as a parameter to the DBContext constructor. Whenever a test version is released, I need to manually replace that app.config (or the connection string) with the test version and the same needs to happen when we implement.

It seems there must be a better (automated and less risky) way of doing this, but I have not figured out what that would be. Am I missing something elegant and built-in, or is there a best practice that I should know about?

Cobus Kruger
  • 8,338
  • 3
  • 61
  • 106
  • You can use XSLT transformations, or SlowCheetah. Check http://stackoverflow.com/questions/3004210/app-config-transformation-for-projects-which-are-not-web-projects-in-visual-stud – Maarten Feb 06 '14 at 13:25
  • That seems to be the way to go! Make it an answer and I'll accept it. – Cobus Kruger Feb 07 '14 at 10:12

1 Answers1

0

You can use XSLT transformations, or SlowCheetah. Personally I've only used XSLT transformations, and the only thing was that the app.config needs to be writeable which didn't work nice with TFS in commandline local builds.

Community
  • 1
  • 1
Maarten
  • 22,527
  • 3
  • 47
  • 68