Updating the App.config file of a dll after installation with a VS2008 setup project RRS feed

  • Question

  • I have a program that i am building that has several different parts to it all in other little mini projects that reference each other, a DLL which has all the logic and back end code and a UI/windows form to handle all the front end logic. The DLL uses an app.config to store a number of settings that have the possibility of changing in the future but the changes would/should not constitute a reinstall of the program. I have created a VS2008 setup project to install the application on a users machine, I set it up so that the primary outputs of the other projects are included for install.

    My question is how can we edit the app.config of the DLL project after the setup has been run? I have looked all around for it and it is not being created in the install directory of the application. I was thinking that I might be able to add the config file to the setup project (to be installed in the application directory), would that work? My goal is to be able to overwrite the app.config and have it read the new settings.
    Friday, January 29, 2010 9:44 PM


  • Hi MrSmileys,

    The app.config file gets renamed on installation. Although the link below refers to VS2005 I imagine that VS2008 is not that different. When adding the primary outputs for the DLL the File Installation Output property should use the name of the config file on installation. Then you will need to create a .Net DLL project based on an installer class and add a custom action to your setup project using the primary output from this installer based .Net DLL. You may need to set the CustomActionData property to pass into the installer class data collected from the user via the install dialogs. VB.Net code sample available if required.

    Hope this helps,

    Steve G

    See "The Visual Studio .NET or Visual Studio 2005 IDE copies App.Config to the folder where the executable file is compiled and renames it in <var><ApplicationName></var>.<var><Application Type></var>.config format".

    Saturday, January 30, 2010 6:19 PM