Tuesday, August 30, 2011

Getting right app.config file in Office Addins

Recently we got one issue while deploying our project’s Office Add-in component in one of the testing machine which has Microsoft Office 2007. We first tested in Excel after initial debugging we could see that one of the registry reading from add in code  is failing.Then we started digging into the inner areas and could see that the registry key is getting formatted using a app.config value, not getting correctly formatted.After some time by putting couple of message boxes we confirmed that the excel add-in is taking app.config file of excel from the below location!!!

<Install Drive>:\Program Files\Microsoft Office\Office12\EXCEL.EXE.config

We tested the manifest files, registry keys etc…but didn’t get any clue. According to us the add in should take its own config file and never the excel’s config file.Used almost all the debugging tools we know but no luck.We even thought of putting our config entries in the excel.exe.config Smile.Since that is not the right way finally started asking google.It gave the reason and solution very quickly.It is very simple .We need to change a registry entry where we specify the vsto addin path. The change seems so silly

The manifest registry entry needs to be prefixed with file:///.ie instead of "[TARGETDIR]ExcelAddIn.vsto|vstolocal": we need to use "file:///[TARGETDIR]ExcelAddIn.vsto|vstolocal":

http://stackoverflow.com/questions/1671587/word-addin-not-reading-appsetting .According to Microsoft this is a performance fix.

Simple fix but it took our half day and it was a SaturdaySad smile

1 comment:

Blogger said...

If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you need to watch this video
right away...

(VIDEO) Get your ex back with TEXT messages?