2

Currently I have a larger Solution with different projects (A web application and a windows service,...). Since both applications use the same database, I created a connectionstrings.config file which is included by the web.confg (or app.config) using the connectsionstring's configsource attribute.

To maintain only one file, I did the following:

  • One project contains the "real" connectionstrings file
  • For all other projects that require the connectionstrings, I have added the existing connectionstrings.config file using the "add as link" option within Visual Studio.

To support different connectionstrings for different environments, I created environment folders that contain their own connectionstrings file. These files are used to replace the default ones during the buildprocess.

I wanted to know if you have other solutions for configuration values within different environments/projects?

Bernhard Kircher
  • 4,132
  • 3
  • 32
  • 38

1 Answers1

3

If you are using Visual Studio 2010, you can use the config transform (video) feature.

See this blog post for details.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • Thank you for your answer - but it seems that this only works for web projects. As I mentioned I have multiple different projecttypes. When searching for more details on your solution, I found the following questions/answers that seem to help [link](http://stackoverflow.com/questions/3004210/app-config-transformation-for-projects-which-are-not-web-projects-in-visual-studi) – Bernhard Kircher Jun 09 '11 at 19:40
  • 1
    @Bernhard - here is a workaround: http://publicityson.blogspot.com/2011/04/visual-studio-xml-file-transformation.html – Oded Jun 09 '11 at 19:43