c# .net help

Soldato
Joined
18 Oct 2002
Posts
4,925
I've built an assembly in c# which I've exposed to Component Services. Within this assembly i'm wanting to use something like Log4Net to do error logging etc.

My problem is I can't seem to be able to get this thing to see the configuration file. I've added an app.config to the project and when I build its generating the projectname.dll.config file but if I use something like ConfigurationManager to assess the AppSettings all I get is invalid pointer.

Doesn't seem to be able to pick anything up.

However if I add a settings file to my project and insert some settings values in their (which appends the setting to the app.config file) I can use the settings object to access the properties.

Any ideas what's going on here?
 
Last edited:
My problem is I can't seem to be able to get this thing to see the configuration file. I've added an app.config to the project and when I build its generating the projectname.dll.config file but if I use something like ConfigurationManager to assess the AppSettings all I get is invalid pointer.
When you use the ConfigurationManager class from within a DLL it will be looking for the config file associated with the host process (in this case dllhost.exe).

Try this: http://blogs.msdn.com/heikkiri/archive/2005/11/10/491568.aspx
 
thanks mate will give that a try looks simple enough.

I did manage to get it sorted last night by creating using filemap.ExeConfigFileName and giving it the location of the application.config file.

then used this in the OpenMappedExeConfiguration method of configuration manager and that gave me access to the config file's appSettings section same thing seems to be working for log4net also.

But the manifest file approach seems simpler.
 
Back
Top Bottom