472,989 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 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 3893
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.