Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remote debug a vsto outlook addin?

I have built an outlook addin, and I'd like to remote debug it running inside a vm on my dev machine (the vm is xpsp3 x32 and outlook 2010, my dev machine is 7 x64 with outlook 2007)

I have (after quite a bit of messing about with user accounts etc) got remote debugging working between vs2010 and the virtual box vm. I can attach to a simple test application and set breakpoints, and they get hit.

However, I can't seem to do the same with the outlook addin. I can't just attach to the outlook.exe process running on the machine as that does not seem to load the addin modules so the breakpoints never get hit.

I can't figure out how to get VS2010 to start outlook on the remote machine from a locally built project, I tried to follow these msdn docs but the instructions to set the working directory don't seem to work, so if I set it as the example suggests and start debugging it comes up with a message saying that the folder does not exist.

If instead I set the Start Action in the debug properties for the outlook addin project to 'Start External Program' and point it at the outlook exe, then VS2010 will successfully start the app, however, the breakpoints are not hit, even though it seems to indicate that they have been successfully set.

Has anyone been successful in remote debugging vsto addins? What am I doing wrong?

like image 962
Matt Avatar asked Jan 20 '11 07:01

Matt


1 Answers

I know this is quite an old question, but just in case someone comes across this post, here is a solution:

  1. On the host machine, in the VSTO project, add this at the top of the startup method.

    MessageBox.Show("Debug"); 
    
  2. Deploy the add in to the remote machine, open Outlook and the MessageBox should display

  3. Run the Visual Studio Remote Debugging Monitor on the remote machine
  4. On the host machine, set a breakpoint on the line after the MessageBox
  5. In Visual Studio, select Debug/Attach to Process from the menu and attach to the Outlook process running on the remote machine
  6. On the remote machine, click on the OK button on the MessageBox you added in step 1
  7. The breakpoint you set in step 5 will now be hit
like image 166
WebMinder Avatar answered Oct 03 '22 09:10

WebMinder