Reputation: 23831
All, I have a large application. This application uses a .config file to deal with its various settings. This is fine in development, and the .config file is found and working happily in the respective \bin
folders (Release and Debug). I have written a NSIS installer an I am now running the app; it is working perfectly, saving settings, restoring settings and generally being a good LAD.
However, the 'MyApp.exe.config' is not where the settings are being written (I have checked and even deleted this so it could be recreated). It is also not in ...Users\Me\AppData\Roaming\MyApp
?
Where the Devil is my applications config file?
Thanks again for your time.
Edit. I have printed out System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
and this points to the Roaming
AppData directory above.
Upvotes: 2
Views: 472
Reputation: 6479
The configuration system for .net gets its settings from several locations.
General config comes from:
Next the settings API gets values from (using the default provider):
If the application's configuration file does not exist it will not be automatically created (doing so would be pointless since it would only contain the defaults the application already knows).
Saving the settings will however create a new user settings file as normal.
Upvotes: 1