I have compiled (hopefully useful) a summary of the ways that I explored to follow up on the topic of this post, as well as the problems that I have with them. Please tell me if you have found other methods that you like best, especially if they solve problems that I do not mention.
Leave the connection strings in web.config and use the XDT / msdeploy conversion to replace them with the settings according to my active build configuration (for example, the web.PublicTest.config file). My problem is that I combine and bury several server-specific parameters in another globally identical file with many configuration elements. Also, I cannot share connection string definitions between multiple peer applications.
Set configSource = "DeveloperLocalConnectionStrings.config" for the connection strings in web.config, and XDT will convert this value to specify one of several environment-related files in my code base. My problem is that I send passwords for all my environments to all destinations (in addition to SVN, of course) and has unused configuration sections sitting on servers waiting for random use.
The specific connection strings in the machine.config file, not web.config. Problem: who the hell expects to find the connection strings in the machine.config file, and the probability of collision of unexpected names as a result is high.
Specify configSource = "LocalConnectionStrings.config", do not convert the value or modify the xml project to prevent the connection string configuration from being deployed. http://msdn.microsoft.com/en-us/library/ee942158.aspx#can_i_exclude_specific_files_or_folders_from_deploymentโThis is the best solution I have found to satisfy my needs for my own (non-distributed) web application, m paranoid other team member will come one day and copy the production site to check for some reason, and voilร !โ The production database now changes during UAT. (Update: I found that I canโt use one-click publishing in this scenario, only the msdeploy command line with the -skip option. File exclusion as mentioned above is similar to setting โNoneโ to compile instead of โContentโ and removes package from the deployment target.)
Connect the deployment package to request a connection string if it is not already installed (I do not know how to do this, but I understand that this is possible). This will have similar results with No. 4 above.
configSource = "..\ConnectionStrings.config". , , . , (, 'appSettings file = ""' - , = configSource = reference).
p.s. : ASP.Net โ