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
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".
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.
I have a word addin and my config is the same as the dll for example somedAddin.dll.config
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With