In article <9A**********************************@microsoft.co m>,
hp*****@discussions.microsoft.com says...
i have a windows app which has an app.config file in the solution. The config
file holds information such as connection string details.
When I create a setup project and include the primary output of my solution
into it then it all installs perfectly....
My issue is this... I may need to amend the app.config file which I do in
notepad on the client machine, however when I need to upgrade the application
I remove the program from the control panel and install the upgraded msi
package... this obviously replaces the amended config file with a "clean"
copy.
How do i ensure that the app.config file which is included in my project is
not deleted when I uninstall the application that it relates to.
Thanks in advance
You can put your custom application settings in a different file, like
Custom.config, like:
<appSettings>
<add key="MyKey" value="Custom" />
</appSettings>
and, in your app.config you will have:
<appSettings file="Custop.config">
<add key="MyKey" value="AllUser" />
</appSettings>
Now, if the Custom.config file is present at the client machine, it's
value will override this one in the app.config. Otherwise, the value in
app.config will be used.
So, this should solve your problem. Once you create Custom.config in the
install dir, it won't be removed upon uninstall, because it was not part
of the install. And the newly installed app.config is going to use it
right away.
Sunny