Reputation: 3301
We are still trying to decide on the best way forward, at present we have an asp.net MVC website with a windows service deployed on a dedicated server we manage and also on some customers infrastructure they manage. We are in the process of migrating the application to Azure although it still needs to support a standard windows deployment. We have this handled but the issue is configuration files.
We currently have custom Xml files which are loaded based on the machine name and the configured customer so if the machine is called machine-01 it goes to a folder called machine-01 and if the customer name is customer-01 it tries to find a file in that folder for customer-01.config. This has worked well for us as each development machine has it's own configuration files and we can create a config file for a customer and save it in TFS.
The problem with this is two fold:
We have started looking at config transforms but we aren't using the web.config/app.config as we are loading these from a custom Xml file. Can we do config transforms on a custom Xml file within visual studio?
Also I am not sure I am happy with this solution as it still leaves production credentials in TFS available to all and still runs the risk of compiling in the wrong configuration and running locally.
While we only have four separate deployments at the moment more customers seem to want to host on their own infrastructure as the product integrates with their systems quite a bit with custom pluggable projects.
My question is how are people handling these types of deployments where there are multiple configuration files particularly from the perspective of trying to hide production credentials from TFS/other developers to mitigate the risk of production credentials used in development but also from the perspective of automating deployment to azure and self hosted windows.
My research is bring up articles from 2006/2008 and I have to believe there are better ways now. We are using Visual Studio Online as well for TFS.
Upvotes: 0
Views: 96
Reputation: 24515
I have recently created an open source project that handles template based configuration files per environment.
See: https://contemplate.codeplex.com/
You can have multiple config files in a solution, hold the setting in one file per enviroment and generate the config files when you needs them.
Upvotes: 0
Reputation: 23434
I would look to Release Management for Visual Studio. It is designed to do what you are talking about and maintains traceability of authority. You can create a release pipeline through multiple environments and have all of the variables for each environment handled automatically.
With this model you have one Web.config for the developers that had the local values and one for RM that has the replaceable variables. Everything is then taken care of at deployment time.
Upvotes: 0
Reputation: 8343
In the past I have been successful using XmlPreprocess. The idea is to markup your config file so they can be processed and macro substituted with values come from a source like an Excel file. You also have the source and adapt the tool to your specific needs.
Upvotes: 0