1

I am working on a web application that use some external dll with config files, such as Lib1.dll, Lib1.dll.config, etc. Basically these files are manually copied into bin folder and only got loaded at run-time.

I tried to add those dll as reference and am able to copy these dll files into bin folder, but how can I deal with those config files? Is there a way I can include these config files in solution and force them copy to bin folder when using Visual Studio publish?

Please help, Thank you.

mhan0125
  • 604
  • 1
  • 11
  • 33

1 Answers1

2

You can include the files into the project in Visual Studio, and change the file property "copy to output directory" (in "Properties Window") to "always" or "copy if new".

vxchin
  • 171
  • 7
  • Works for me. But the annoying part is that I need to include Lib1.dll and Lib1.dll.config directly under my project, if I create a folder named "libs" and put them in it. Then after rebuild it creates a "libs" folder under bin folder instead of put them directly under bin folder. Any idea? – mhan0125 Apr 20 '15 at 22:25
  • I think the simplest way is to add the config to the root of the web project directly..NET doesn't really support configuration associated with a library in the way you are attempting; and this is by design. See: http://stackoverflow.com/questions/9762938 – vxchin Apr 21 '15 at 02:42