JMarsch
JMarsch

Reputation: 21751

Any components for working with shared config files?

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?

Upvotes: 0

Views: 366

Answers (4)

Mike Chaliy
Mike Chaliy

Reputation: 26698

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 :)

Upvotes: 0

Aron
Aron

Reputation: 15772

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>

Upvotes: 1

Simon Mourier
Simon Mourier

Reputation: 139256

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());
            }
        }
    }
}

Upvotes: 3

Dhawalk
Dhawalk

Reputation: 1269

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.

Upvotes: 1

Related Questions