I do not understand the following things:
Kind Regards PK
So the default settings are stored in the <exename>.config
file located in the same directory as the executable.
The reason you do cannot find the user.config file is it is only created if you have made changes to the defaults. The user settings override the defaults which are stored in the <exename>.config
file. If no changes have been made, then no user configuration file will exist. And... once it does exist you will notice that only the settings which have been changes will show up in the user.config file.
To test this... create a dummy variable called like temp in your Settings file. When you start your application do:
Settings1.Default.temp = Settings1.Default.temp + 1;
Settings1.Default.Save();
You will now have a file called user.config created in the user's ApplicationData folder which on Vista is in: C:\Users\<username>\AppData\Local\<company>\<productname>
Here is some code I wrote to help identify where all the various SpecialFolders where on different Operating Systems. (Might want to do a find-replace for log.Debug
and replace with Console.WriteLine
)
log.Debug("SpecialFolder.ApplicationData: " + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData ));
log.Debug("SpecialFolder.CommonApplicationData: " + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData ));
log.Debug("SpecialFolder.ProgramFiles: " + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
log.Debug("SpecialFolder.CommonProgramFiles: " + Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles ));
log.Debug("SpecialFolder.DesktopDirectory: " + Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory ));
log.Debug("SpecialFolder.LocalApplicationData: " + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData ));
log.Debug("SpecialFolder.MyDocuments: " + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments ));
log.Debug("SpecialFolder.System: " + Environment.GetFolderPath(Environment.SpecialFolder.System ));
Output On Windows Server 2003:
SpecialFolder.ApplicationData: "C:\Documents and Settings\blake\Application Data"
SpecialFolder.CommonApplicationData: "C:\Documents and Settings\All Users\Application Data"
SpecialFolder.ProgramFiles: "C:\Program Files"
SpecialFolder.CommonProgramFiles: "C:\Program Files\Common Files"
SpecialFolder.DesktopDirectory: "C:\Documents and Settings\blake\Desktop"
SpecialFolder.LocalApplicationData: "C:\Documents and Settings\blake\Local Settings\Application Data"
SpecialFolder.MyDocuments: "C:\Documents and Settings\blake\My Documents"
SpecialFolder.System: "C:\WINDOWS\system32"
Output on Vista:
SpecialFolder.ApplicationData: "C:\Users\blake\AppData\Roaming"
SpecialFolder.CommonApplicationData: "C:\ProgramData"
SpecialFolder.ProgramFiles: "C:\Program Files"
SpecialFolder.CommonProgramFiles: "C:\Program Files\Common Files"
SpecialFolder.DesktopDirectory: "C:\Users\blake\Desktop"
SpecialFolder.LocalApplicationData: "C:\Users\blake\AppData\Local"
SpecialFolder.MyDocuments: "C:\Users\blake\Documents"
SpecialFolder.System: "C:\Windows\system32"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With