Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is VS 2013 copying ASP.NET MVC 4 web.config to bin and renaming?

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?

like image 241
ewbi Avatar asked May 04 '15 01:05

ewbi


People also ask

Can we run MVC application without web config?

Yes but you can run with out debugging mode and do't configure any setting in web. config file.

What is the use of web config file in ASP NET MVC?

The web. config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS.

What is the use of Web config in view folder in MVC?

The web. config file exists in the Views folders to prevent access to your views by any means other than your controller. In the MVC design pattern, controllers are supposed to route requests and return a rendered view to the calling client.


1 Answers

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?

like image 198
John Hodge Avatar answered Nov 15 '22 22:11

John Hodge