Reputation: 7931
I have a C# Class Library (dll; .net 4.0). I'll call it "mytestlib". I added a Settings.setting to it which also adds a app.config file to the project. It has a couple of application scope properties in it and also some user scope properties.
During debug I can see the "mytestlib.dll.config" file in the bin\Debug folder where I expect it to be. However, when I install the library using an MSI installer I do not find the "mytestlib.dll.config" anywhere on the system! Where does Microsoft put the app.dll.config?? I am starting to suspect it is actually embedded in the dll (I hope that is not the case).
I do know it is there somewhere because the exe application that uses this dll does successfully pull settings from the "mytestlib.dll.config" file. The problem I do not know where the file is.
btw, I am able to find the user.config.
Please help and thank you in advance!
Note: I can do this same thing with a Windows Form applcation (exe) and then install that using an MSI installer and I find the app.exe.config side by side with the .exe as I would expect. Why does the app.dll.config not work the same way?
Upvotes: 1
Views: 1133
Reputation: 7931
According to the documentation there is no configuration file model for class libraries. The app/user settings defined in the libarary will actually use the app/user.config of the exe that is referecing the library. Therefore there is no app.dll.config (the settings go in the app.exe.config of the app referenceing the dll).
Upvotes: 0
Reputation: 4458
Couple of things:
1 - You should put consider putting relevant config entries in the launching *.exe.config. These will be picked up by the DLL accordingly.
2 - Your installer probably wouldn`t know about the conifg file unless you specifically told it to anyway.
3 - The DLL config file was created for use in test projects and other scenarios, not necessarily for runtime, though you could probably deploy it and use it at runtime if you so wished.
Upvotes: 2