I am changing the configuration file in Visual Studio,the program language is C#,and the enviroment is .net framework 4.0+windows 7.this is my code:
#region change configuration file
/// <summary>
///
/// </summary>
/// <param name="createdTime"></param>
[TestCase("2015-06-12 14:37:59")]
public void ChangeConfiguration(string createdTime)
{
string str = System.Environment.CurrentDirectory+@"\App.config";
string appDomainConfigFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
Configuration config = ConfigurationManager.OpenExeConfiguration(str);
AppSettingsSection appSettings = (AppSettingsSection)config.GetSection("appSettings");
appSettings.Settings.Remove("queryTime");
appSettings.Settings.Add("queryTime", createdTime);
config.Save();
ConfigurationManager.RefreshSection("configuration");
}
#endregion
And the program generate a new configuration file named:App.config.config
.How could this being?I just want to modify the queryTime in original file.
ps:This is my App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="interval" value="5"/>
<add key="queryTime" value="2015-06-10 14:37:59"/>
<add key="_TimerInterval" value="5000"/>
</appSettings>
</configuration>