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

x
?
Solved

Trouble with persisting user settings when install new version

Posted on 2014-11-20
6
Medium Priority
?
169 Views
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.Upgrade();
                Properties.Settings.Default.UpgradeSettings = false;
                Properties.Settings.Default.Save();
        }

Open in new window


The old settings was kept in the file "user.config" at the location:
C:\Users\dwong\AppData\Local\Company\MyTool.exe_Url_bp2u4og4vwazxwbxllvfhrz3ph3omcfd\1.1.0.4

After installing the new version, I could see a new "user.config" at a new location:
C:\Users\dwong\AppData\Local\Company\MyTool.exe_Url_pjgudcgzuigkvokmjnwldqaecw2hgaz5\1.1.0.5

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.
0
Comment
Question by:dominicwong
[X]
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
6 Comments
 
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
0
 

Author Comment

by:dominicwong
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:
C:\Users\dwong\AppData\Local\Company\MyTool.exe_Url_bp2u4og4vwazxwbxllvfhrz3ph3omcfd\1.1.0.4
C:\Users\dwong\AppData\Local\Company\MyTool.exe_Url_pjgudcgzuigkvokmjnwldqaecw2hgaz5\1.1.0.5


My new empty test project put all the new versions under the same directory as:
C:\Users\dwong\AppData\Local\WfApplication1\WfApplication1._Url_tsje4qn52nzeqpaxfmlrpijgg1rryu4g\1.0.0.0
C:\Users\dwong\AppData\Local\WfApplication1\WfApplication1._Url_tsje4qn52nzeqpaxfmlrpijgg1rryu4g\1.0.0.1
C:\Users\dwong\AppData\Local\WfApplication1\WfApplication1._Url_tsje4qn52nzeqpaxfmlrpijgg1rryu4g\1.0.0.2
C:\Users\dwong\AppData\Local\WfApplication1\WfApplication1._Url_tsje4qn52nzeqpaxfmlrpijgg1rryu4g\1.0.0.3


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

Thanks in advanec
0
 
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

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

 

Author Comment

by:dominicwong
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.
   C:\Users\{User}\AppData\Local\{CompanyName}\{ExecutableName}_Url_hash\1.0.0.x

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

Accepted Solution

by:
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.
0
 

Author Closing Comment

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

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