Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Trouble with persisting user settings when install new version

Posted on 2014-11-20
Medium Priority
Last Modified: 2014-12-02
Hi experts
I have some trouble in restoring persisted user config settings when installing a new version of my C# .NET application.

I have the following lines right at the beginning of my main program:
       // if(Properties.Settings.Default.UpgradeSettings). Temporary took out for testing
                Properties.Settings.Default.UpgradeSettings = false;

Open in new window

The old settings was kept in the file "user.config" at the location:

After installing the new version, I could see a new "user.config" at a new location:

But the code above didn't copy the old user settings, could someone point to me where I might have done wrong.

FYI, I am using C#, .NET 3.5, Installer.

Thanks in advance.
Question by:dominicwong
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 16

Assisted Solution

by:Vikram Singh Saini
Vikram Singh Saini earned 800 total points
ID: 40457207
But the code above didn't copy the old user settings, could someone point to me where I might have done wrong.

Well! I don't think you are doing wrong at any point.

However can you delete the respective Company folder in Local folder in AppData? And then test same again.

I would suggest link at Automatically upgrading user settings after an application version change

Author Comment

ID: 40461101
Thanks Vikram Singh Saini.
I'd taken a look at the link and the approach is similar to what I did.

I'd created an empty project, and retested my original approach. The issue seems to be related to the different directory path that was created in the 'AppData\Local' directory by my original program:

My new empty test project put all the new versions under the same directory as:

The question is what triggers my original program to create a different path everytime? Any idea?

Thanks in advanec
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 40461349
Mind if you can share your test project for testing purpose.

Just want to give it try to experience same weird issue.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 40461391
Thanks Vikram Singh Saini.

The test project actually works fine. It generated the same hash for every new version, and put the 'user.config' for any subsequent newer versions under the same directory.

The weird issue is, therefore, not with the test project but rather with my original project which generated a different hash every time.

Accepted Solution

dominicwong earned 0 total points
ID: 40469833
Found the issue was due to appending a version number to the 'ProductName' in the installer setup project. That somehow triggered a new path to be created for the user.config upon every new release.

Author Closing Comment

ID: 40475518
Thanks Vikram Singh Saini for your offer to help.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question