COM objects in C# with config files.
-
Hello I have a question about working with COM objetcs made in C#. Creating the objetcs is not a problem, my question is how to work with config files. How do I get information from an config file so that I can read it with my COM object? My situation right now is that I have a .Net object that most of the time will be accessed by a .Net application, but somtimes by an application written in VB6 (or any language supporting COM). In the config file for the .Net application I have some parameters that I want to read, not just in the appSettings section but also for example configSections and system.diagnoostics section. I hope that Microsoft has thought of that when they made .Net support COM, but I dont know how they did it if they did it. Antoher solution is to always try to read the config file with ConfigurationManager.OpenExeConfiguration(FilePath) but then I cant read some sections properly without resorting to converting them into a XMLDocument:
Or should I abandon config files and use INI files instead? Is there a way in an .Net object to see if the object is started by an application using COM or if it is an .Net application? I hope the question(s) are reasonably clear and that someone could enlighten me in the way of using config files when the calling application is an COM application written in VB6. Sorry for my bad english. Best regards /Marcus