Where to store configuration data for COM add-in?

G

Gary McGill

I'm developing a COM add-in for Word & Excel, using C# and VS.NET 2003.

I need to store configuration data for my add-in somewhere, but I'm not sure
where to put it. I suppose I'm looking for the equivalent of app.config - an
XML configuration file would be ideal.

In case you're still wondering what's stopping me from using an XML
configuration file, my problem is: how does my add-in know where to look for
the file? Is there a convention for where the add-in itself will be stored?
Should I just put the config file in the same directory as the add-in DLL?

I'd much prefer to use a config file than the registry - I need to be able
to edit the file easily.

TIA,
Gary McGill
 
P

Peter Jausovec

Hi Gary,

Use System.Reflection.Assembly.GetExecutingAssemlby().CodeBase property to
get the full path of your DLL file. Then, just append ".config" and you got
yourself a config file :)
 

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