clickOnce and Config file

I

Irfan

hi,

After installing the application in the client machine using ClickOnce, i
would like that the client be able to change the
database path in the Application.Config file. However, clickonce does not
copy the Application.Config file when it deploys.

How can i be able to do it, Am i missing something in ClickOnce.

Thanks
Irfan
 
R

RobinS

It probably does copy the Application.Config file (it's called app.config).
ClickOnce stuff gets installed under the user's Documents&Settings (XP)
folder somewhere, and it is obfuscated so he can't muck with it. The
app.config file is probably in there somewhere. The problem is, you can't
modify the information in the app.config file with code.

To get around this, I rolled my own settings stuff, with the default for
the ConnectionString hardcoded, and the user can modify it. I store it in
Environment.SpecialFolder.LocalApplicationData + "\myAppName". Then when
the app is upgraded to a new version, I don't lose my settings. This is
also the recommended location by Vista, so you don't have a problem with
Vista security either.

Good luck.
Robin S.
 
I

Irfan

Rob,
Thanks for the reply.
I have another question:
How do u redirect the program to look at the ConnectionString of YOUR
config file instead the default config file.

irfan
 
R

RobinS

I don't used strongly typed datasets. I use stored procedures that load
DataSets, and my Data Access layer pulls the connection string from my
config file and uses it when opening the connection.

Are you using strongly typed datasets?

Robin S.
-----------------------
 
I

Irfan

yes, I am using stongly typed datasets that creates a readonly
ConnectionString.
However, I deleted that ConnectionString and created a new Property in the
settings file with the SAME name.
This new property pulls the data from the XML file. What do you think about
it? Do you reckon it will
create any problems in future.

irfan
 
R

RobinS

Well, if it works, that's great. You just have to remember if you recreate
the strongly typed dataset, to delete the ConnectionString again.

Robin S.
-----------------------------
 
I

Irfan

thanks again Rob

irfan


RobinS said:
Well, if it works, that's great. You just have to remember if you recreate
the strongly typed dataset, to delete the ConnectionString again.

Robin S.
 

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