473,378 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Making app.config permanent

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

Jul 21 '05 #1
7 3919
I use InstallShield with a VB6 application. I had the same issue, both
InstallShield and Windows Add/Remove liked to delete my configuration file
because it was installed as part of the application.

The solution I came up was to install the file with a different name (say,
"Initial.config"). Then, I programmed the application to look for this
file, and if found, rename to a difference name. Because the now renamed
file was not part of the initial installation, the uninstall applications do
not delete it.

Richard Rosenheim

"hplloyd" <hp*****@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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

Jul 21 '05 #2
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
Jul 21 '05 #3
I am working on a similar problem. I am doing exactly the same thing
(renaming files) in Uninstall and Install. Here is the problem, what if
uninstall was called as a result of un installing the application not
upgrading.
This way the user is left with *.config file
Any one has a solution.
How do I find out what triggers(calls) uninstall, an upgrade or uninstall .
Thanks. I am using vb.net.

"Sunny" wrote:
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

Jul 21 '05 #4
In article <45**********************************@microsoft.co m>, mach2
@newsgroup.nospam says...
I am working on a similar problem. I am doing exactly the same thing
(renaming files) in Uninstall and Install. Here is the problem, what if
uninstall was called as a result of un installing the application not
upgrading.
This way the user is left with *.config file
Any one has a solution.
How do I find out what triggers(calls) uninstall, an upgrade or uninstall .
Thanks. I am using vb.net.


I was peaking of creating a new file with the custom settings. That was
what the OP was after. He needed a way to preserve the customization he
made. Uninstall is not going to delete a file which is not part of the
corresponding install procedure. So, The proposed custom.config file
will survive the uninstall/upgrade.

Sunny
Jul 21 '05 #5
This way if the user uninstalls the application, he or she is left with
custom.config file in the application directory. If it is an upgrade keep the
config file and if it is an uninstall dont keep the file(no files should be
left behind). Is there any way to do this. Thanks.

"Sunny" wrote:
In article <45**********************************@microsoft.co m>, mach2
@newsgroup.nospam says...
I am working on a similar problem. I am doing exactly the same thing
(renaming files) in Uninstall and Install. Here is the problem, what if
uninstall was called as a result of un installing the application not
upgrading.
This way the user is left with *.config file
Any one has a solution.
How do I find out what triggers(calls) uninstall, an upgrade or uninstall .
Thanks. I am using vb.net.


I was peaking of creating a new file with the custom settings. That was
what the OP was after. He needed a way to preserve the customization he
made. Uninstall is not going to delete a file which is not part of the
corresponding install procedure. So, The proposed custom.config file
will survive the uninstall/upgrade.

Sunny

Jul 21 '05 #6
In article <86**********************************@microsoft.co m>, mach2
@newsgroup.nospam says...
This way if the user uninstalls the application, he or she is left with
custom.config file in the application directory. If it is an upgrade keep the
config file and if it is an uninstall dont keep the file(no files should be
left behind). Is there any way to do this. Thanks.
This should be done in the installer. You will need something like
InstallShield.

Sunny

"Sunny" wrote:
In article <45**********************************@microsoft.co m>, mach2
@newsgroup.nospam says...
I am working on a similar problem. I am doing exactly the same thing
(renaming files) in Uninstall and Install. Here is the problem, what if
uninstall was called as a result of un installing the application not
upgrading.
This way the user is left with *.config file
Any one has a solution.
How do I find out what triggers(calls) uninstall, an upgrade or uninstall .
Thanks. I am using vb.net.


I was peaking of creating a new file with the custom settings. That was
what the OP was after. He needed a way to preserve the customization he
made. Uninstall is not going to delete a file which is not part of the
corresponding install procedure. So, The proposed custom.config file
will survive the uninstall/upgrade.

Sunny

Jul 21 '05 #7
yes it can be done in vs.net custom action or i figured out a way to do this.
wow.

"Sunny" wrote:
In article <86**********************************@microsoft.co m>, mach2
@newsgroup.nospam says...
This way if the user uninstalls the application, he or she is left with
custom.config file in the application directory. If it is an upgrade keep the
config file and if it is an uninstall dont keep the file(no files should be
left behind). Is there any way to do this. Thanks.


This should be done in the installer. You will need something like
InstallShield.

Sunny

"Sunny" wrote:
In article <45**********************************@microsoft.co m>, mach2
@newsgroup.nospam says...
> I am working on a similar problem. I am doing exactly the same thing
> (renaming files) in Uninstall and Install. Here is the problem, what if
> uninstall was called as a result of un installing the application not
> upgrading.
> This way the user is left with *.config file
> Any one has a solution.
> How do I find out what triggers(calls) uninstall, an upgrade or uninstall .
> Thanks. I am using vb.net.
>

I was peaking of creating a new file with the custom settings. That was
what the OP was after. He needed a way to preserve the customization he
made. Uninstall is not going to delete a file which is not part of the
corresponding install procedure. So, The proposed custom.config file
will survive the uninstall/upgrade.

Sunny

Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jony Joe | last post by:
Dear All; I am now making a deployment package using the .net deployment setup project. It is a desktop application that its solution contains 7 projects that generate DLLs and EXEs...
1
by: EdwinSlyfingster | last post by:
How can I do to web.config to be permanent(Wont be unistalled)? thanks.
7
by: hplloyd | last post by:
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...
0
by: S. Justin Gengo | last post by:
A while ago I submitted a bug report for a problem that occurrs when using the admin tool. There is now a "permanent" fix available I thought I'd share. First the problem was: After running the...
1
by: mmitchell | last post by:
I have a VB.Net 2005 solution that uses an installer project to install. When I do an install I would like the app.config/application config file to be installed only when there isn't one...
3
by: john.enevoldson | last post by:
Hi, We have a significant (and increasing) number of identical databases spread over numerous servers (linux) and are finding it a pain making table changes since we are currently issuing the...
2
by: Siegfried Heintze | last post by:
I made the following change to my web.config file (see fragment below) but does not seem to affect the timeout on my web page. I have a huge session state but since I'm the only one using it, I'd...
7
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir =...
1
Shinobi
by: Shinobi | last post by:
I am using ASP.net(c#) for my project. In my my project 2 pages are using URL rewriting method by referring this article URL Rewriting using Intelligencia UrlRewriter Example 1 - Blog Day...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.