0

This question is continue with How to keep Settings details in Visual Studio application? ticket.

I have tried by following but it set blank my old LocalSetting data. Program.cs

//get current version which is 1.1.0 after upgrade
string tempVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
tempVersion = tempVersion.Remove(tempVersion.Length - 2);
//tempVersion = 1.1.0

//it will check whether is new version installed
//Settings.Default.ProductCurrentVersion = 1.0.0. So, it will called
if (Settings.Default.ProductCurrentVersion != tempVersion)
{
    MessageBox.Show("New Version: " +tempVersion);
    MessageBox.Show("Old Version: " +Settings.Default.ProductCurrentVersion);
    Settings.Default.Upgrade();
    Settings.Default.Save();
    //Local Settings data will be blank here.
}

Can anybody suggest what I am missing here?

Community
  • 1
  • 1
Nanji Mange
  • 2,155
  • 4
  • 29
  • 63
  • @timothyclifford I have tried this as all they suggest by `Settings.Default.Upgrade();` but it blank my string type values. Also review this http://stackoverflow.com/questions/37136808/how-to-keep-settings-details-in-visual-studio-application/37137236#37137236 – Nanji Mange May 10 '16 at 13:30
  • Please followup with your original question until you've marked it as answered. – Peter Ritchie May 10 '16 at 13:59
  • Have you check that `Settings.Default` contains data before calling `Upgrade()`? – timothyclifford May 10 '16 at 14:22
  • @timothyclifford It's done. I misunderstood the approach has been suggested. – Nanji Mange May 11 '16 at 04:55

0 Answers0