4

Here's what I did:

From VS2010 > new C# Project (from Other Project Types > Extensibility > Shared Add-in) > some basic configuration in the Connect class

After that I set in the project properties > debug > start external program, the path for winword (C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE)

When creating a shared add in, the setup files are in a separate project, in the same solution. so i did a build for the add-in, and installed it.

when i start word (separately or from Start with debug from visual studio) the add-in runs fine, but it can't seem to hit any breakpoints?

If I modify something and do just Build, when i start word again, the changes are there, so it must be the correct dll that word is loading

Question is of course, how do i get breakpoints to work?

Andrei S
  • 6,486
  • 5
  • 37
  • 54

1 Answers1

5

First, breaks won't work at all if you run through an installed instance of the addin. You HAVE to start the addin from inside VS to be able to do any debuggins (ok technically not completely true, I +THINK+ you can "attach" to a running instance but I've never debugged that way.

You'll want to make sure you're in DEBUG build configuration. Release mode won't necessarily set things up to allow debugging.

You should be able to REBUILD the entire solution before starting it. Rebuilding the solution will register things with the registry so that word +SHOULD+ find you're add in properly.

Finally, make sure that, during all your testing runs etc, Word hasn't disabled your add in. Check Options/Addins/Com Addins and make sure your in the list and enabled.

If you're addin fails for some reason, word has a habit of disabling it and from then on not loading it unless you reenable.

DarinH
  • 4,868
  • 2
  • 22
  • 32
  • the add-in has a ribbon tab, and when i uninstall the add-in, word removes the ribbon. if i reinstall it it goes back. if i hit run in VS while uninstalled, word starts but no ribbon there. if i hit run while installed, ribbon's there in word but debug won't work. under no cases the addin is disabled (i've checked) – Andrei S Nov 19 '10 at 21:01
  • It sure SOUNDS like the addin is being registered to the installed copy and not to the copy that VS builds right before it starts word to being a debug session. If that's the case, then word is loading the wrong copy of the dll and VS isn't hooking into it for debugging purposes. Usually, doing a CLEAN, then doing a FULL REBUILD and finally running the app from within VS will get it registered properly. unless you don't have appropriate rights on the Local machine. – DarinH Nov 29 '10 at 22:55
  • Attaching to the running process works fine, although it is obviously more hassle than hitting 'F5'. – Holf Jul 10 '13 at 10:15
  • True enough. I've since learned how the "attach to running process" debugging works. A bit more hassle, but it does allow you to debug many situations that would be difficult otherwise. – DarinH Jul 11 '13 at 11:55