I need to specify a different location for my settings file. After many long hours of searching, I found out that I have to write my own SettingsProvider. I succeeded in creating one which allows me to specify a path for settings file via its constructor. Programatically, I can contruct it like this:
var mycustomprovider = new CustomSettingsProvider(path);
The problem I am having is that there's no way to invoke my custom provider. I can decorate the VS 2008 generated setting file with the following attribute:
[SettingsProvider(typeof(CustomSettingProviders.CustomSettingsProvider))]
internal sealed partial class Settings {
}
However, the attribute doesn't allow me to construct the object with a path. Also, I want to be able to set the SettingsProvider programmatically so that I can pass in any path I want at runtime and save my settings. The examples I've seen on the net have never mentioned how to use a invoke a SettingsProvider programmatically.