Explicitly load config settings from .NET assembly

K

Kevin Lewis

Is there .NET framework code that I can call from an assembly (.dll), that
will load the settings of a configuration file into the .NET framework. For
example you can set up Switches and TraceListeners through config settings
such as:

<system.diagnostics>
<switches>
<add name="MySwitch" value="31" />
</switches>
<trace>
<listeners>
<add name="MyListener" type="Common.Listeners, Common" />
</listeners>
</trace>
</system.diagnostics>

but if I have code running as a Word addin there is no easy way to load them
through a config file because a Word addin does not have the usual
AppName.exe.config file that regular applications use.

Does anyone know how to do this?

Thanks in advance

Kevin
 
J

Joshua Flanagan

The same naming convention and behavior works with unmanaged hosts as
well (although the host can choose to use a different config file when
creating your app domain). Try naming the config file
winword.exe.config and put it in the same folder as winword.exe. I'm
assuming that Winword.exe is the unmanaged host. To verify which
executable loads your managed code, try using ProcessExplorer from
SysInternals (www.sysinternals.com). It will highlight all processes
that are running managed code, which should help you identify the one
you want.

Joshua Flanagan
http://flimflan.com/blog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top