Reputation: 427
So I have WPF
application
and I am using settings.settings
file to save several settings for example specific Path
that the user need to set and I am also create a exe
installation file using Advanced installer
and after install new application
version all the application files (include the application exe
file) replaced with the new version and in such case all settings.settings
variables reset and I want to prevent it.
Any ideas ?
Upvotes: 0
Views: 565
Reputation: 137
For Windows Forms apps I use code like this in my main form, after the call to InitializeComponent(). It copies the settings from the previous version the first time the new version runs.
if (Properties.Settings.Default.FirstTimeRunningThisVersion)
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.FirstTimeRunningThisVersion=false;
Properties.Settings.Default.Save();
}
FirstTimeRunningThisVersion is type bool and its default value must (obviously) be True.
Upvotes: 0
Reputation: 11
If I understand correct, when you upgrade your application you want your settings.settings file to be saved. If you don't want to use "Side by side install", you can do this:
xcopy /Y %1 %2
If this is what you need and you can't implement it, just tell me and I will try to help you.
Upvotes: 0