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?
I'm unsure what you mean. Have you tried including it in a similar way to the following?
<appSettings file="dataSettings.config"/>
精彩评论