Keeping settings between Clickonce updates

Hi

I am using ClickOnce deployment and application settings.

I am developing a small pice of software for my friends and using click once to update it, but after every upddate the app loses its user settings (my.settings)

How can I persist them through updates?

im sure im missing somthing simple.

Thanks
Simmy

[331 byte] By [simmy] at [2008-2-4]
# 1
Hi Simmy,

Unfortunately, user settings are placed in a path partially determined by the assembly's identity. When you update your assembly, you'll end up with a different path.

However, there is a way for you to code what you want by hand. ClickOnce has a concept of an application data directory, in which files can be placed that are migrated across versions. If you place a file in the data directory (by choosing it's build type as Content), then it will always be moved up when you update your application.

Also, IsolatedStorage will also be moved up with each version of your ClickOnce application. So you could simply create an Application scoped IsolatedStorage stream, and store your settings there.

Unfortunatley neither of these will help you get your settings via My.Settings -- you'll have to parse the file that you pull out yourself Sad

Hopefully that helps to point you in a direction that will work for your application's settings.

-Shawn

ShawnFarkas-MS at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 2

The settings get upgraded for you automatically in Clickonce deployed applications when you install a new version. However, there was a bug in Beta 2 of .NET 2.0 that prevented this from working right. This should work fine in a recent CTP drop and definitely in the final release.

For more on settings and upgrade, see this FAQ that I posted sometime back:

http://blogs.msdn.com/rprabhu/articles/433979.aspx

RaghavendraPrabhuMSFT at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 3
Thanks, sorry for the late reply it didn't alert me.

I think il deal with settings manually for now then.

Thanks again.

simmy at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 4
Sorry I am also following this issue and wondering about the same. In the blog listed it says to call

Properties.Settings.Default.Upgrade();

Is this to replace the settings just installed by click once with the pervious version saved on the users machine, or are you saying its not possible to do this with app.config file?

Thanks In Advance
Martin

MartinMcNally at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 5

The default provider will upgrade only user scoped settings, not application scoped ones. Application scoped settings can be upgraded by simply deploying a new app.exe.config file with the new version of your application.

RaghavendraPrabhuMSFT at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...