I have deployed this application using Visual Studio 2010's Publish feature; it needs to save a few user settings (such as database connection information) and there is this particular computer that somehow keeps resetting the application's settings. The part that puzzles me the most is that I have not been able to figure out under what circumstances or the reason why this happens. I know the settings are getting set properly because the application has worked just fine on 6 or 7 other computers.
What could be erasing the application's settings? Alternatively, what would you suggest I use to store those settings? An encrypted file?
EDIT:
I am using the default application settings. They are defined in the app.config file.
They can be accessed using Properties.Settings.Default.propertyName
To disable ClickOnce security settings With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Security tab. Clear the Enable ClickOnce Security Settings check box.
config file is stored in the user's Documents and Settings folder. In a ClickOnce application, <app>.exe. config lives in the application directory inside of the ClickOnce application cache, and user. config lives in the ClickOnce data directory for that application.
To specify a custom Web page for a ClickOnce applicationSelect the Publish pane. Click the Options button to open the Publish Options dialog box. Click Deployment. In the Publish Options dialog box, make sure that the Open deployment web page after publish check box is selected (it should be selected by default).
For anyone who runs into this problem: Check if you have an unconditional
Properties.Settings.Default.Upgrade();
in your code. In a ClickOnce installation with multiple versions, this statement copies the user settings from a previous version and overwrites any settings that were saved in the last session. The correct pattern is:
if (Properties.Settings.Default.UpgradeRequired)
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.UpgradeRequired = false;
Properties.Settings.Default.Save();
}
where UpgradeRequired
is a setting that defaults to true.
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