none
How can i change app.config after deployment?

    Question

  • Hello,

    i'm deploying my application using ClickOnce.

    After deploying it i change a connectionstring manually in app.config in the deployed directory.

    But my application seems not to use that changed connectionstring.

    When i'm doing just a release build, it works! I can change the string after building an after restarting the application the new string is used.

    Can please anyone give me a hint?

    regards Oliver
    Thursday, December 01, 2005 4:07 PM

Answers

  • Thank You for your answer.

    I made a workaround now:

    I don't have to many different installations (6) so i made a project for each customer. Each project has it's own app.config.

    Oliver
    Friday, December 02, 2005 2:40 PM

All replies

  • Take a look at the following example

    http://www.eggheadcafe.com/articles/20030907.asp

    Cheers, Patrick
    Thursday, December 01, 2005 4:23 PM
  • Thank you Patrick,

    this solution doesn't help.

    My problem is not to change the app.config file. My Problem is to get the Application to use the changed Configuration.
    I change the app.config using a text editor but my applicaiton does not accept that change.

    I'm using clickonce and Windows Forms

     regards!
    Thursday, December 01, 2005 4:55 PM
  • I guess it depends, are you having your end-users change the connectionstring, if your end users are changing the connection, you could create a dialog that prompts the user for the connection, Keep the variable in a global static string, save the manifest with the new connectionstring, then when the application restarts, put the connection string from the manifest back into the global string again.
    I have a ClickOnce application that requires an sqlconnection that changes per user/site and Once deployed I provide my customers with the IP thats needed for the sqlconnection which is then saved back in the app.config.  Hope this helps. Patrick
    Thursday, December 01, 2005 5:41 PM
  • Thank You for your answer.

    I made a workaround now:

    I don't have to many different installations (6) so i made a project for each customer. Each project has it's own app.config.

    Oliver
    Friday, December 02, 2005 2:40 PM
  • I'm a very beginer. Can you give me a sample code for this ?

    Wednesday, November 12, 2008 4:06 PM