Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to app.config in a referenced project

Say I have 2 projects, where project A references project B. Project A is a web application project and project B is a class library.

The class library has an app.config file where some settings are stored. When I compile project A, projectB.dll is created in the bin folder.

What happens to the contents of the app.config file when the web application is deployed? Are the settings compiled into ProjectB.dll?

Is it possible to retrieve the contents of the app.config using a tool like reflector or ILSpy?

like image 229
woggles Avatar asked Dec 07 '11 08:12

woggles


People also ask

Where is app config file located?

The application configuration file usually lives in the same directory as your application. For web applications, it is named Web. config. For non-web applications, it starts life with the name of App.

What is the use of app config in C#?

App. Config is an XML file that is used as a configuration file for your application. In other words, you store inside it any setting that you may want to change without having to change code (and recompiling). It is often used to store connection strings.

Is app config and web config are same?

You can have a web. config for each folder under your web application. app. config is used for windows applications.


1 Answers

You can add an app.config to a library project, but it is not used or included in any of the output.

Configuration is meant to be done in the application - not in the library. So you need to put the configuration in question in the web.config of your web application, not in app.config of a library.

like image 115
Andrew Barber Avatar answered Oct 07 '22 00:10

Andrew Barber