By default, Cinchoo framework creates and uses App.exe.Config and other configuration files under the executable folder. In a protected environment, where the ‘program files’ folder is protected and no write access is available, you will need to instruct the framework to use ‘AppData’ folder or any other write accessable folder for all the configuration management. This can be done as below
Step 1. In the Main Method, subscribe to ChoApplication.AfterConfigurationManagerInitialized event
class Program { [STAThread] static void Main(string[] args) { ChoApplication.AfterConfigurationManagerInitialized += ChoApplication_AfterConfigurationManagerInitialized; } }
Step 2. In that event, invoke one of the ChoConfigurationManager.OpenExeConfiguration() method as below
static void ChoApplication_AfterConfigurationManagerInitialized(object sender, EventArgs e) { ChoConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal); }
Advertisements