|
-
Oct 9th, 2003, 10:57 AM
#1
Thread Starter
Addicted Member
Does application configuration files work with DLLs?
I have a DLL that I just added the Exception Management Application Block . The default publisher works fine (writes to Event Viewer).
However, I want to use a custom publisher which requires an "application configuration file", such as application.exe.config. Theres an example on that page (I'm using the same exact custom publisher and trying to use the same exact configuration file... at least until I get it working, then I'll customize it.)
It seems like my application.dll.config file isn't being read by the application. I haven't used the Application Configuration files before, so I don't know if I'm doing it right or not. I just copied the XML on that page to myDLL.dll.config and put it in the same directory as my DLL.
Any ideas?
-
Oct 9th, 2003, 11:19 AM
#2
You can add an app.config file from the project add new items menu. This makes it part of your project. Also there is a sort of one to one relationship with config files. So an application using a dll that uses a config file doesn't access the dll's config file only the dll can. If that makes since. The dll can use its own config file but an application that uses that dll can not. At least not through an object like AppSettingsReader anything can open any xml file via the xmldocument object or dataset object.
-
Oct 9th, 2003, 03:08 PM
#3
Thread Starter
Addicted Member
Thanks. I understood all of that, but my DLL still isn't reading the app.config file.
Should the DLL read the app.config file automatically or is it embedded inside of the file? I guess I'm just confused about how this works. Do I need to read the file when the DLL is called?
Does anyone have any links to basic info about the app.config files?
-
Oct 9th, 2003, 04:05 PM
#4
Unless you are using dynamic properties then you'll need to read values from the config file in your dll. You can use the Configuration.AppSettingsReader object or a couple others in the Configuration namespace (i.e. Configuration.AppSettings.GetSetting). The auto part is that you don't specific file information when using these objects it knows to look in the app.config file.
-
Oct 9th, 2003, 04:51 PM
#5
Thread Starter
Addicted Member
Thanks. I found out that I can't use app.config files with DLLs. I made an EXE file and everything loaded automatically using the EMAB. When I compile my DLL, it doesn't create the app.exe.config file.
For anyone interested in an EMAB tutorial here is a good one.
http://builder.com.com/5100-6373-5055434.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|