C# - 无法调试office word加载项 [英] C# - can't debug office word add-in

查看:311
本文介绍了C# - 无法调试office word加载项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我做的:



从VS2010>新的C#项目(从其他项目类型>扩展性>共享加载项)>一些基本配置在Connect类之后我设置了项目属性> debug>启动外部程序,winword的路径(C:\Program Files(x86)\Microsoft Office\ Office12 \WINWORD.EXE)



创建共享添加时,安装文件位于单独的项目中,位于相同的解决方案中。所以我做了一个加载项的构建,并安装了它。



当我开始单词(单独或从可视化工作室的调试开始)加载项运行好的,但似乎没有任何断点?



如果我修改一些东西,做Build,当我重新开始一个字,变化就在那里,所以它必须是正确的dll该字正在加载



问题当然是我如何得到断点工作?

解决方案

首先,如果您运行安装的插件实例,则休息将无法正常工作。你可以从VS内部启动插件,以便能够执行任何调试功能(在技术上不是完全正确的,我+ THINK +可以附加到一个正在运行的实例,但是我从来没有调试过。



您需要确保您正在进行DEBUG构建配置。发布模式不一定设置为允许调试。



您应该可以在开始之前重新整理整个解决方案,重建该解决方案将使用注册表注册一些内容,以使单词+ SHOULD +可以正确添加。



最后,确保在所有测试运行过程中,Word没有禁用您的添加。检查选项/ Addins / Com Addins,并确保您在列表中并启用。



如果您因某种原因导致插件失败,则有习惯禁用它,从而无法加载,除非您重新启用。


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?

解决方案

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.

这篇关于C# - 无法调试office word加载项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆