6

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

Tor Hovland
  • 1,629
  • 2
  • 15
  • 23
boz
  • 419
  • 5
  • 15

3 Answers3

3

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".

Tor Hovland
  • 1,629
  • 2
  • 15
  • 23
1

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.

boz
  • 419
  • 5
  • 15
  • 1
    Did it work for you? I have a Excel addin but my .config file named is based on the addin name and it works fine. – A9S6 Dec 08 '09 at 06:30
1

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

Bradley
  • 104
  • 3
  • 2
    Can anybody explain why some users can get addin.dll.config to work, while others must use winword.exe.config? (I belong in the latter group.) – Tor Hovland Jul 06 '11 at 11:54
  • Update: The following thread helped me. I have posted an answer about this as well. https://connect.microsoft.com/VisualStudio/feedback/details/653444/visual-studio-sp1-or-specifically-vsto-sp1-issue-with-config-file-location – Tor Hovland Jul 06 '11 at 12:28