Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to share the web.config across multiple projects in a solution?(ASP.NET)

Tags:

asp.net

I have a solution composed of a web application and multiple projects, is it possible to share the configuration in the web application across all the solution?

Thanks

like image 966
Gigapr Avatar asked Oct 24 '10 08:10

Gigapr


People also ask

Is it possible to use multiple web config files in ASP NET?

I attended one interview at that time they asked one question that is it possible to use multiple web.config files in single asp.net application? For that question answer is Yes we can use multiple web.config files in single web application but how?

Is it possible to use one config file for multiple projects?

Well, I think it is very common scenario where a single Application Configuration File (app.config) or Web Configuration File (web.config) needed to be used to multiple projects on the same solution. Hence I thought of putting it as tip for you. Lets see how to do this in steps.

What is web config in IIS?

The web.config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS. web.config file location In order to set up the ASP.NET Core Module correctly, the web.config file must be present at the content root path (typically the app base path) of the deployed app.

What is web config in ASP NET Core?

The web.config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS. In order to set up the ASP.NET Core Module correctly, the web.config file must be present at the content root path (typically the app base path) of the deployed app.


1 Answers

I looks like it is possible, you can try following:

You can copy your web.config file to the root folder of your solution. Then create solution folder (which does not belong to any of your projects) and add your file there (via Add Existing Item popup menu item). Delete web configs from your web sites. After that you can select Add Existing Item from popup menu on your both web projects, select your web.config file from the solution root and click Add As Link. After that you will have links to your web config files instead of real ones in your solution.

alt text

On the other hand I'm not sure if sharing of the web.config files among different projects is a good idea, because usually web.config has some specific condifuration for each separate application.

like image 137
Andrew Bezzub Avatar answered Sep 21 '22 11:09

Andrew Bezzub