- I have .NET assembly with some classes marked as
ComVisible - This assembly is registered with
regasm /codebase "assembly_path" - I have app.config name (actually –
MyAssemblyName.dll.config) which are in assembly’s folder - I access to appSettings in my assembly through
ConfigurationManager.AppSettings["SettingName"] - I have VBScript file which creates my COM object through
CreateObject("...") - When object is created (from VBScript),
ConfigurationManager.AppSettings["SettingName"]returns null. It looks like assembly doesn’t see config file.
What should I to do to make it workable?
One possible way, as Komyg said, is to read config file directly, instead of using ConfigurationManager’s embedded behavior. For those, who will have the same problem: instead of
you can use:
This way you will always use read settings from file
YourAssemblyName.dll.configwhich lays in your assembly’s folder. It will allow you to use also another features forapp.config(likeappSetting‘sfileattribute), which will no be available if you will use XPath or something like this.