10
votes

I just noticed that during a build, Visual Studio 2013 is copying the web.config from the root of my ASP.NET MVC 4 web app project into the bin folder and renaming it for the resulting web app DLL with a .config extension. It's a straight copy because the files have the same timestamp.

I'm familiar with the build doing this for app.config files in executable Windows/console projects, but why is it doing it for a web app that will depend on web.config at runtime?

1
Additionally, I just verified that the VS Publish feature does not include this [dll].config file when performing a file- or web-based deployment; the file only appears in the project's bin folder following a build.ewbi
This happens with MVC 5 and VS 2015 as well. I wonder if there's a way to prevent this behavior since it doesn't seem to make any sense.Tom Pažourek
I'm also seeing this: the web.config is copied to the bin folder and renamed TestWebProject.dll.config. We don't want this because we encrypt our web.config at deployment time and this is another config file that we didn't know would be there.NickRamirez

1 Answers

2
votes

As best as I can tell, the config file in the bin folder does nothing except to allow you to keep settings that are needed for that DLL in a handy place should you decide to incorporate that DLL into a larger project. In that case you would probably want to merge the config file into the hosting apps config file.

Here's a related question that may give some more insight. What use has the default (assembly).dll.config file for .NET-Assemblies?