Global configuration in CAB/SCSF application

Jan 24, 2008 at 8:54 AM
Edited Jan 24, 2008 at 8:57 AM

My Problem:

I want to define/read/write some global configuration settings in my CAB/SCSF application.

What I did:

  • I tried to define them using Visual Studio 2008 project settings: -> right click Shell project -> properties -> Settings -> Set all the variables I need
  • I can access these variables from the shell project easily using Properties.Settings.Default.variableName

The problem I have is that I cannot access the variables from other Modules/WorkItems :(

My questions:

1) What is the correct way to do this?
2) Is there a ready to use solution in CAB, SCSF, Enterprise Library, ...?

Jan 24, 2008 at 3:05 PM
Provide the settings as a Service.

In our application, we store settings in a database. We read those settings on application startup, and provide them as a Service. This has the added benefit of allowing each user to customize the application to some degree by adjusting the settings.

But even if you didn't want to save settings to a database and just wanted to make some global data available to other portions of the application, the Service still holds true.
Jan 24, 2008 at 3:26 PM
Edited Jan 24, 2008 at 3:28 PM
Well after searching the web for several hour I think the service solution is the fastest way to do it.
I regret that I can't use the Visual Studio project settings :(

During my search I found the following code block:

ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
configFileMap.ExeConfigFilename = "Shell.exe.config";

Configuration config =

string myConfigValue = null;

System.Configuration.KeyValueConfigurationElement kvConfigObj =

if (null != kvConfigObj)
myConfigValue = kvConfigObj.Value;

This allows me to access some elements of the app.config file (the appSettings).
But I cannot access the applicationSettings and usersettings sections in file app.config created by Visual Studio as I described in my first post.