I successfully wrote a C# console application that collects .XML
or .ZIP
files from different locations and copies them to a single destination. Those locations are stored in the settings as User-scoped settings (for instance, "Folder01 C:\Data1\"
and "Folder02:\Data2"
). As you probably already know, building the project generates a [ProjectName].exe.config
file in the /bin/Debug
folder.
Now, the issue is that I cannot get the console app to recognize any changes that I made in the .exe.config
file. Say, I want to add "Folder 03 C:\Data3\"
to the settings or edit "Folder02"
path to "C:\DataEdited\"
, the console app will still loop through the settings as initially set up in the code ("Folder01 C:\Data1\" and "Folder02 C:\Data2\").
I also noticed that the console app still runs even after deleting the .exe.config
file, as if it does not rely on the file at all. I would like to make changes without having to open the project in Visual Studio and edit locally.
Is that possible?
EDIT:
In response to the request of the Settings that I created and code for getting folder paths, see image image below:
string[] acceptedExtensions = new[] { ".xml", ".zip" };
string[] settingsToSkip = new[] { "RootFolder", "ArchiveFolder" };
// Collect data
var filteredSettings = Properties.Settings.Default.Properties
.Cast<SettingsProperty>()
.Where(p => !settingsToSkip.Contains(p.Name));
filteredSettings collects Folder01, Folder02, Folder03 and Folder04 and I loop through those to find files with acceptedExtensions.