Hello,
we have 2 saperate application which need to follow each other setting means when athe first application started it read setting from xml file and write data there and when the second application araised then ity need to get the data from the first application setting and change it accrodingly.
All the issue strated because we would like to deploy ClickOnce with install and run strategy and we have 2 application runs (saperate applications).
how to implement it, i thought the ApplicationSettingsBase can help us but it configure to specific application by unique location and name, so how other application can work with that.
Does registry can be an option or its not recomended.
Bye regards.
Yaron Karni
My blog : http://dotnetbible.blogspot.com

Shared application setting among saperate applications, How to do it usign new application setting platform ?
Dhivya.S
The registry is not normally recommended for .NET apps but if you have settings that you want to share across a suite of products then a general registry key for your products is still the way to go. However you will no longer be able to use xcopy deployment or ClickOnce.
As for sharing configuration information you can use ConfigurationManager.OpenMappedExeConfiguration to define and load a Configuration object which you can then access like you would standard application settings. This is sort of non-standard though. If you do follow this approach then create a separate assembly that handles all the details internally and exposes an ApplicationSettingsBase-style class that your apps can interact with. To make this more compliant you should probably define a SettingsProvider class that uses CM and the method internally. You then use the SettingsProviderAttribute to on your custom ApplicationSettingsBase class to identify the provider to use. This gives you a level of isolation from the underlying storage schema. In summary.
public sealed class SharedConfigurationSettingsProvider : SettingsProvider
{
public override void Initialize ( )
{
ExeConfigurationFileMap map = new ExeConfigurationFileMap();
map.ExeConfigFilename = execonfigfile;
map.LocalUserConfigFilename = userconfigfile;
map.RoamingUserConfigFilename = roamingconfigfile;
//Load the shared configuration file
m_cfgAll = ConfigurationManager.OpenMappedExeConfiguration(map, None);
m_cfgRoaming = ConfigurationManager.OpenMappedExeConfiguration(map, None);
m_cfgUser = ConfigurationManager.OpenMappedExeConfiguration(map, None);
}
private Configuration m_cfgAll;
private Configuration m_cfgRoaming;
private Configuration m_cfgUser;
}
[SettingsProvider(typeof(SharedConfigurationSettingsProvider)]
public sealed class MyApplicationSettings : ApplicationSettingsBase
{
//Properties to get and set application values
}
A couple of comments about the code. Firstly I'm not sure if you can specify a full path and filename or whether the config file must reside in the same directory as the application or in a pre-defined path (for users and roaming users). Secondly I'm a big fan of delay loading so instead of initializing everything up front you should load a configuration file only when you need it the first time. This mandates some additional work such as a private property that loads the configuration as needed but it ultimately makes for a better user experience.
Michael Taylor - 10/31/06