C# - can't debug office word add-in

好久不见. 提交于 2019-12-22 08:46:23

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/4226435/c-sharp-cant-debug-office-word-add-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!