Arrangement settings for .NET class libraries (DLLs)

It is really easy to demonstrate arrangement settings for .NET executables, by adding an app.config record to the endeavor that is consolidated with an .exe.config report in the executable coordinator. In any case, since libraries or DLLs don’t continue running alone, and rely upon clients to execute, how might one decide assorted settings in different calling conditions, especially if the library documents are set in a lone region on the PC, for instance, the worldwide social gathering store?

Starting late this request rose so frequently in the endeavors that I have been working on that I decided to analyze the decisions even more eagerly. I found that a couple of subtleties of the procedures have not been explained wherever, so decided to compress the available choices here. There radiate an impression of being four various ways to deal with decide library settings, each with its own focal points and failings.

The settings can be made in the class library by adding them to the ‘appSettings’ part of the app.config added to the library adventure (see figure). The drawback of this technique is that each assembling get necessities to duplicate this setting in its own app.config (collected into an .exe.config or .dll.config), since that is the primary spot looked for by the code above. The condition ends up massive when the amount of settings required by the library increases.

The settings can be made in the class library as custom settings, by adding a settings archive to the endeavor ( (VS.80).aspx), and showing the settings to be used in the Settings organizer of Visual Studio (see underneath).

Eventually, if the setting is to be given by the calling gathering, it must be fused as a custom setting in decisively a similar plan in the assembling get’s .exe.config. This is really inconvenient as the amount of settings increases. Regardless, inclination (or disadvantage) of this strategy is that the default assessment of the setting is organized into the library code through the ‘DefaultSettingValueAttribute’ in the Visual Studio delivered code (see above). Thusly, if the assembling get doesn’t give the setting, the default regard is used. This appears to be appealing just in a test setting, as in progress code, the customer gets no opportunity to get of understanding the default setting that was associated in the library aside from if unequivocally demonstrated in a chronicle or config record furnished with the library documents.