0

I have a scenario where 1 Winform app is installed on multiple Citrix servers. The app should have exactly the same configuration on each server (we have multiple servers for scale).

I would like to be able to share just 1 copy of the app.config file, so that I can make a change in 1 place and have it effect every installation of the application.

As nearly as I can tell, the only built-in support from .net is to use the configSource attribute, but that only works for individual config sections. I would like to share the whole config file (or at least config groups).

Am I missing anything built into .net that would help me?

If not, are there any good third party or open source solutions out there?

JMarsch
  • 21,484
  • 15
  • 77
  • 125

4 Answers4

3

You could put your app.config somewhere on a share and modify your winform application startup code, using the trick described on SO here: Change default app.config at runtime, something like this:

namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            using (AppConfig.Change(@"\\myserver\mypath\app.config"))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        }
    }
}
Community
  • 1
  • 1
Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
1

The following link talks about 3rd party tools you could use to synchronize files and folder

http://raywoodcockslatest.blogspot.com/2011/01/windows-7-raid-or-mirror-across.html

Also, have you tried writing your own replicator service. depending upon your time and budget you can make a decision to build or buy. I would perhaps build it.

Dhawalk
  • 1,257
  • 13
  • 28
1

Another good solution described in SO is to use config includes. Use XML includes or config references in app.config to include other config files' settings

<!-- SomeProgram.exe.config -->
<configuration>
  <connectionStrings configSource="externalConfig/connectionStrings.config"/>
</configuration>

<!-- externalConfig/connectionStrings.config -->
<connectionStrings>
  <add name="conn" connectionString="blahblah" />
</connectionStrings>
Community
  • 1
  • 1
Aron
  • 15,464
  • 3
  • 31
  • 64
  • Thanks Aron -- I knew about that one, but the problem is that it only works on sections, and each section has to have its own file (you can't combine 2 sections into 1 file). I was really looking to redirect the whole config file. +1 though. – JMarsch Feb 20 '13 at 14:14
0

This is possible to use "shared" folder created with something like SkyDrive, Dropbox or even DFS.

On each server you will have same copy of the config file. As a benefit you can use this approach even for binary files (you should deal with file locks of course).

I was using this approach

  1. to deploy web application (with configuration) to the farm, this were done with DFS.
  2. to deploy desktop app with Dropbox. I created special account for this. I am not, however, sure if this is legal use of Dropbox :)
Mike Chaliy
  • 25,801
  • 18
  • 67
  • 105