Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should consider <a href="http://configgen.codeplex.com/">ConfigGen</a>. It was developed for this purpose. It produces a config file for each deployment machine, based on a template file and a settings file. I know that this doesn't answer your question specifically, but it might well answer your problem.</p> <p>So rather than Debug, Release etc, you might have Test, UAT, Production etc. You can also have different settings for each developer machine, so that you can generate a config specific to your dev machine and change it without affecting any one else's deployment.</p> <p>An example of usage might be...</p> <pre><code>&lt;Target Name="BeforeBuild"&gt; &lt;Exec Command="C:\Tools\cfg -s $(ProjectDir)App.Config.Settings.xls -t $(ProjectDir)App.config.template.xml -o $(SolutionDir)ConfigGen" /&gt; &lt;Exec Command="C:\Tools\cfg -s $(ProjectDir)App.Config.Settings.xls -t $(ProjectDir)App.config.template.xml -l -n $(ProjectDir)App.config" /&gt; &lt;/Target&gt; </code></pre> <p>If you place this in your .csproj file, and you have the following files...</p> <pre><code>$(ProjectDir)App.Config.Settings.xls MachineName ConfigFilePath SQLServer default App.config DEVSQL005 Test App.config TESTSQL005 UAT App.config UATSQL005 Production App.config PRODSQL005 YourLocalMachine App.config ./SQLEXPRESS $(ProjectDir)App.config.template.xml &lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt; &lt;configuration&gt; &lt;appSettings&gt; &lt;add key="ConnectionString" value="Data Source=[%SQLServer%]; Database=DatabaseName; Trusted_Connection=True"/&gt; &lt;/appSettings&gt; &lt;/configuration&gt; </code></pre> <p>... then this will be the result...</p> <p>From the first command, a config file generated for each environment specified in the xls file, placed in the output directory $(SolutionDir)ConfigGen</p> <pre><code>.../solutiondir/ConfigGen/Production/App.config &lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt; &lt;configuration&gt; &lt;appSettings&gt; &lt;add key="ConnectionString" value="Data Source=PRODSQL005; Database=DatabaseName; Trusted_Connection=True"/&gt; &lt;/appSettings&gt; &lt;/configuration&gt; </code></pre> <p>From the second command, the local App.config used on your dev machine will be replaced with the generated config specified by the local (-l) switch and the filename (-n) switch.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload