Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Word addin not reading appSetting

I have built a simple word addin that interacts with a company intranet.

For some reason, I cant seem t get the addin to read appSettings from its config file.

Is there something fundamental that doesn't allow office addins to read config files like a normal .Net application?

cheers

like image 397
boz Avatar asked Nov 04 '09 03:11

boz


3 Answers

This thread helped me:

https://connect.microsoft.com/VisualStudio/feedback/details/653444/visual-studio-sp1-or-specifically-vsto-sp1-issue-with-config-file-location

In particular, this solved the problem for me:

You'll need to make the change in your deployment project, not in the .vsto or .manifest files. Specifically, you need to change the string written in the "Manifest" registry value. For example, the walkthrough in this article directs you to set the "Manifest" value to "[TARGETDIR]ExcelAddIn.vsto|vstolocal": http://msdn.microsoft.com/en-us/vsto/ff937654.aspx. To satisfy the new URI scheme requirement for Fast Path loading, you actually need to set the value to "file:///[TARGETDIR]ExcelAddIn.vsto|vstolocal".

like image 133
Tor Hovland Avatar answered Sep 30 '22 19:09

Tor Hovland


In this case the config file needs to be associated with the winword.exe executable.

So for app settings to be read by an addin, even though the call to ConfigurationManager.AppSettings is in another dll, the setting must sit in winword.exe.config.

like image 42
boz Avatar answered Sep 30 '22 19:09

boz


I have a word addin and my config is the same as the dll for example somedAddin.dll.config

like image 28
Bradley Avatar answered Sep 30 '22 21:09

Bradley