Tuesday, December 27, 2011

How to debug the word add in project in Visual Studio

Last few days I was playing much with MS word add ins and its development, Yes you are right, when the word ‘develop’ comes into the picture , each and every developer needs to think some logic and then they let the figures do the remaining job. There are many times when run-time error occurs and developer go ahead and track/find them using debugger.
Most of us use Visual Studio, the developer’s heaven as IDE for the .NET based application development and Microsoft has given way too good features to debug your code. (Link here)
Some examples:
·         When debugging web based projects / SharePoint farm solutions , one attaches the debugger to the w3wp.exe (IIS process)
·         When debugging sandboxed solutions one needs to attach the debugger to the SPUCWorkerProcess.exe (SPUC)
·         And again while debugging the timer jobs in SharePoint debugger needs to be attached to Timer service. (OWSTimer.exe)
Ok ok, before I get the question like – come on we know all of these.. I will come to the point directly.
I learnt a lesson that if you need to debug the MS Office Addins then you must attach the debugger to the appropriate MS Office Client.
In my case, as I was working with MS Word Addin – so I needed to attach the debugger to WINWORD.exe service, like this

If you do not see WINWORD.exe process , make sure that you have launched the MS Word Client and selected – Show all process , show process from all users/sessions in the attach debugger window.
Also If the debugger is not getting attached, then make sure that the add-in is referring to the dll is latest in the respective location. (For example If add in is referring to the dll somewhere in release folder of your solution then make sure that the dll is latest)

No comments:

Post a Comment