Automatically “upgrade” user settings from previous version of app.config file?

三世轮回 提交于 2019-11-27 19:22:23

Have you looked at ApplicationSettingsBase.Upgrade()? It allows the settings to be upgraded from a previous version using the following call:

My.Settings.Upgrade()
Alex

Not sure why but neither the upgrade command or the get previous version seems to work for me. What could I be doing wrong? Do I need to call a refresh command or something. I am doing this on form load, should it be an application event?

UPDATE

Found out why, it seems it does not work when you use a 4 digit major version number. I was using the year 2012 as the major version number. I have changed that to 12 and it works like a charm, though is no not millenium compliant. Still I got 88 years before I need to start worrying about that!

Have you considered ClickOnce deployment? This topic is then covered in depth. IMO, ClickOnce is much easier both for the developer and the user.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!