Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add settings from another project to app.config

I have written an application in C# with a settings file (which is used to create an app.config file at compile time). This application uses a C# DLL which also has a settings file.

I read the following from this post:

If you build a project that references your DLL, you would add the same .settings file to that project and those settings would appear in the app.config file for the app and the DLL would be able to read those values. IF those values aren't in the app.config, the dll will fall back on the defaults.

I observed the DLL storing default values as this indicates it should. I right clicked on my application's project and selected Add Existing Item. Then I found the settings file from my DLL's project and added it to the application's project. My hope was that both the DLL settings file and the application settings file would be included in the application's app.config file. This way, the application's app.config file would override the defaults stored in the DLL. Unfortunately, this isn't happening.

So, my question is after adding the settings from the DLL project to the application project, how do I make the application project recognize the file and add its settings to the app.config file at compile time?

like image 562
Brian Avatar asked Nov 14 '22 09:11

Brian


1 Answers

I'm unsure what you mean. Have you tried including it in a similar way to the following?

<appSettings file="dataSettings.config"/>
like image 137
Phil C Avatar answered Dec 08 '22 21:12

Phil C