views:

45

answers:

1

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?

A: 

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

<appSettings file="dataSettings.config"/>
Carnotaurus
If you post code or XML, **please** highlight those lines in the text editor and click on the "code" button (101 010) on the editor toolbar to nicely format and syntax highlight it! It's especially for XML because otherwise, it might just not show up (like your line just wasn't visible)....
marc_s
My app.config file is being automatically generated by the C# compiler. The compiler readings by Settings.settings file and uses it to generate XML to include in the app.config file.My objective here is to have one Settings.settings file (in the DLL project) set up so that if I make a change in that Settings.settings file, the change will cause the app.config file to be updated in both locations. I could simply create a copy of the Settings.settings file in the application project, but I'm trying avoid needing to change two files each time I adjust a setting.
CyBri2000