473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

My.Settings.Upgrade doesn't upgrade?

Hi all,

In my VB 2005 project I create a setting called UpgradeRequired with a
default value of True, and I include the following code that runs when the
project is launched:

If My.Settings.UpgradeRequired Then
My.Settings.Upgrade()
My.Settings.UpgradeRequired = False
My.Settings.Save()
End If

This code should allow a user to run one version of my app which saves
settings, then run a newer version of the app and automatically have the
saved settings applied to the newer version of the app. But (as you guessed
by the fact that I'm posting this question) it's not working. When I run
the newer version of my app I just get the default values for all of the
settings.

To try to get to the bottom of this, I need to understand what magic
My.Settings.Upgrade uses to determine if there was a previous version of the
app settings. I notice that the persistence mechanism creates a user.config
file in a new application folder for each new version of my app:

My Profile
Application Data
My Company
MyApplication.exe_Url_abcdefg
1.0.0.0
MyApplication.exe_Url_hijklmn
1.1.0.0

However, when I create simple test program that does the same thing, and
just change the file and assembly version numbers between runs, it puts both
"version" folders under the same application folder:

My Profile
Application Data
My Company
MyApplication.exe_Url_gibberish
1.0.0.0
1.1.0.0

So, something that I am doing when I build and install my application in a
production environment is causing the My.Settings magic to think that what
newer versions of my application are a totally different application.

My application consists of a main program and a bunch of strong name signed
DLLs, all of which share the same assembly and file version strings. Each
time I create a new version of my application I create a new, higher version
number and rebuild the whole kit and caboodle with that new version number
baked into all of the assemblies.

One other thing I'm doing is this: Each of the DLLs has its own user-scoped
settings (maintained in the magic My Project -Settings designer). This
seems to work as expected; each assembly "sees" its own settings via
My.Settings.<SettingName>, and all of the settings are persisted in separate
sections of the user.config file.

TIA - Bob
Nov 15 '08 #1
3 6785
It turns out that there is one more crucial point that I didn't think of:
Each new release of my app is installed into a different folder! (We have a
requirement to be able to have multiple versions of the app installed
side-by-side.) So, the My.Settings magic probably considers each new
release a different app because it comes from a different location.

That leaves me with the question of how to tell My.Settings that it should
consider any version of my app to be the same app even if its location has
changed. Is that possible?

TIA - Bob

Nov 15 '08 #2
Thanks Hongye, signing my application solved my problem!

Bob
Nov 17 '08 #3
You are welcome, Bob. I am glad that my suggestion helps you.

Have a nice day.

Regards,
Hongye Sun (ho*****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
*

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 18 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tappy Tibbons | last post by:
Have many of you upgraded to VS 2003? We have been using Visual Studio 2002, and are somewhat satisfied, except for the following areas: Speed - VS2002 apps are dead dog slow to start up, and...
4
by: Dave Harney | last post by:
Hi Newsgroup, I'm currently using VS Ver 7.0.9466 with an OS of Server 2000 (domain controller) Ver 5.0.2195 (Build 2195) SP4. I have MSDN Universal and would like to upgrade my development...
3
by: John | last post by:
Hello, I am trying to figure out how to determine if I have fixed an upgrade warning. If I delete the green text then the upgrade warning goes away. However, I would expect it to come back...
3
by: davepkz | last post by:
I have a basic question about managing user.config settings: In my C# app, I save the user's preferences to the config file. But each time I release a new build of the app, something in .NET...
2
by: Graham Charles | last post by:
Since the .config file that contains the values in My.Settings is saved to... %USERPROFILE%\Local Settings\Application Data\<companyname>\<appdomainname>_<eid>_<hash>\<verison> ....that...
3
by: David Cartwright | last post by:
Hi all, Apologies if this is a FAQ - I've searched all the groups I can think of, though. I've written a VB.NET application and an associated Installer project in Visual Studio 2005....
3
by: Tsahi Asher | last post by:
hi, i was trying to save the window size of my app using the generated Settings class of Visual C# 2005 Express. for some reason, the stored size was bigger from the actual size, so each time i...
7
by: Just_a_fan | last post by:
I save some data to an array in my program. I can reopen the setting screen and see that the data is, in fact, in the array. I then do a lot of these: My.Settings.Brkr1 = BreakerAmps(1)...
13
by: John | last post by:
Our technical guy says that our linux server is running PHP 4. I thought we were running 5 already. He says he wants to charge us £500 a year to install and support it because it is a lot of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.