修改外部AppSetting的内容
/// <summary>
/// 修改AppSetting
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
public static bool ModifyAppSetting(string appPath, string key, string value)
{
try
{
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(appPath);
config.AppSettings.Settings[key].Value = value;
config.Save(ConfigurationSaveMode.Minimal);// .Modified);
return true;
}
catch(Exception ex)
{
return false;
}
}