ClickOnce Deployment and the ConfigurationSection

S

SR

I have created an application that stores my configuration settings using
the ConfigurationSection, ConfigurationElements, and
ConfigurationElementCollection. Due to the complexity of my configuration
(hence the collection piece) I did not try using the settings API. I have
now gotten to the point where I need to worry about deployment and updates.
ClickOnce deployment works great except for the fact that everytime my
application gets updated, the settings will get lost.

Is there a way to use ConfigurationSection along with ClickOnce and get the
settings transferred on an update? Or do I need to investigate another
method of updating or store my settings in another manner?

TIA

Seth
 
F

Fabio Cozzolino

Hello SR,
Is there a way to use ConfigurationSection along with ClickOnce and
get the settings transferred on an update? Or do I need to
investigate another method of updating or store my settings in another
manner?

try to use the ApplicationSettingsBase.Update() method (http://msdn2.microsoft.com/en-us/library/system.configuration.applicationsettingsbase.upgrade.aspx)
to upgrade your settings. You can check the ApplicationDeployment.IsFirstRun
property (http://msdn2.microsoft.com/en-us/li...ication.applicationdeployment.isfirstrun.aspx)
and then execute ApplicationSettingsBase.Update():

if (ApplicationDeployment.CurrentDeployment.IsFirstRun)
{
ApplicationSettingsBase.Update();
}

HTH
------
Fabio Cozzolino
Microsoft MCAD.NET
DotNetSide Community Manager
Blog: http://dotnetside.org/blogs/fabio

Workshop ".NET Present & Future" - Bari, 26 Ottobre 200
 
S

SR

Thank you for the response Fabio.

I have seen these articles before but a question still remains. Where do I
apply this?

Thanks,

Seth
 
F

Fabio Cozzolino

Hello SR,
Thank you for the response Fabio.

I have seen these articles before but a question still remains. Where
do I apply this?

Thanks,

Seth

Hi SR,
sorry for my bad response. When you install a new version of your application
with ClickOnce, ApplicationSettingsBase automatically upgrade settings for
you at the point settings are loaded. It is very strange that doesn't work
for you. Is your application deployed as Online or Online/Offline?

------
Fabio Cozzolino
Microsoft MCAD.NET
DotNetSide Community Manager
Blog: http://dotnetside.org/blogs/fabio

Workshop ".NET Present & Future" - Bari, 26 Ottobre 2006
 
S

SR

It is online.

Does it have anything to do with the fact that I have custom configuration
settings using the System.Configuration methods and objects?

Seth
 
F

Fabio Cozzolino

Ciao SR,
It is online.

Does it have anything to do with the fact that I have custom
configuration settings using the System.Configuration methods and
objects?

I don't think. You consider that with the online deploy, your application
is not installed on client. This mean that no files are copied on client
machine. Therefor you lose changes at your local settings when shut down
your application.

There is no way to change this. In my opinion, you can only deploy with online/offline
capabilities.

HTH
------
Fabio Cozzolino
Microsoft MCAD.NET
DotNetSide Community Manager
Blog: http://dotnetside.org/blogs/fabio

Workshop ".NET Present & Future" - Bari, 26 Ottobre 2006
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top