Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I share Configuration Settings across multiple projects in Visual Studio?

Tags:

People also ask

How do you share code between projects solutions in Visual Studio?

Each project will reference the same location on disk. Doing this is very simple. In the target location, right click the folder and select “Add > Existing Item…” Usually you'd just press “Add,” but in this case, you actually want to click the dropdown and select “Add As Link.”

Where are Visual Studio project settings stored?

settings is located in the My Project folder for Visual Basic projects and in the Properties folder for Visual C# projects. The Project Designer then searches for other settings files in the project's root folder.


I have a Visual Studio web application solution. I have three projects as UserInterface, BusinessLogic and DataAccess.

I had to store some user defined settings and I created configSections in the config file.

I access these configSections through classes which inherit from .NET's ConfigurationSection base class.

So in short for every project I had a separate configSection and for that corresponding configSection I had a class in that project inheriting from ConfigurationSection to access the config section settings.

This works all sweet. But the problem arises if there is any setting which I need to use across multiple projects. So If I need to use a setting defined in UserInterface project configSection in, let say, BusinessLogic project I have to actually make a copy of that setting in the BusinessLogic's configSection. This ends up having the same setting copied across multiple configSections.

Isn't this a bit too redundant?


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!