Thursday, February 26, 2009

Howto add a dll app.config file in setup project in Visual Studio

Steps to ship the config file with the dll in a setup project.
In my particular case I needed the dll config file for a WCF service client inside a MMC snapin.

For the library:
  1. Create a dll project. (e.g. myLibrary)
  2. Add a configuration file.
  3. Rename the configuration file as "projectName".dll.config. (e.g. myLibrary.config.dll)
  4. View the properties for the configuration file and set them to:
  • Build action: Content (to reference later in setup)
  • Copy to output: Copy always
For the deployment project:
  1. Create a setup project or a merge module.
  2. Select the Add the project output and then:
  • Select primary output for the library project. (this includes the dll)
  • Select project content for the library. (this includes the configuration file)
Simple and painless :-)
Hope can help someone with this.
Works for C# or VB.NET.

1 comments:

  1. Thank you! This was what I was looking for!

    ReplyDelete