Cinchoo – Open configuration files in AppData folder

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s