I have this
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="FBI" type="System.Configuration.NameValueSectionHandler" />
</configSections>
<FBI>
<add key="FilePath" value="D:\C Drive\Desktop\test1.txt"/>
</FBI>
<configuration>
in app.config
..
And I set the Copy to Output Directory
for app.config
to copy if newer.
In the program,
var section = ConfigurationManager.GetSection("FBI") as NameValueCollection;
FilePath.Text = section["FilePath"];
where FilePath
is a label.
When I change the config file to
D:\C Drive\Desktop\test2.txt
and build using VS (release mode), it shows correctly as
D:\C Drive\Desktop\test2.txt
But if I change the app.config in release folder to
D:\C Drive\Desktop\test3.txt
and run using the exe file in the release folder directly, it still shows me
D:\C Drive\Desktop\test1.txt
without updating to test3.txt
What's the reason?