如何使用Office 2007调试VSTO 2005解决方案? [英] How to Debug a VSTO 2005 Solution with Office 2007?

查看:69
本文介绍了如何使用Office 2007调试VSTO 2005解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我为Word构建了一个VSTO 2005解决方案,它在Word 2003中运行得很好,但在Word 2007中失败了。没有调试就很难修复错误,所以我的问题是:是否存在一种运行Word 2007调试VSTO 2005解决方案的方法?如果没有,你会建议我什么?

谢谢。

解决方案

嗨Oleg,



让我试着在这里读一行。由于您正在开发预期在Word 2007上运行的自定义,我假设您已编写了加载项?据推测,您正在询问如何调试已部署到​​没有Visual Studio的计算机上的加载项。我做对了吗?我希望如此,因为预计VSTO 2005文档自定义不会在Word 2007上运行(出货时需要升级到VSTO 3.0)。



如果是这样,只要机器联网,就可以设置远程调试会话。首先,您需要将安装路径 \ Microsrosoft Visual Studio 8 \ Common7 \IDE \Remote Debugger \ x86 \ msvsmon.exe复制到共享(如果Visual Studio安装在默认位置,则安装路径为%ProgramFiles%。然后转到目标计算机,连接到共享并运行msvsmon。您需要打开防火墙以启用远程调试;当你启动它时,msvsmon会提示你这样做。如果使用与调试用户帐户不同的用户帐户登录目标计算机,则需要在msvsmon上选择权限并添加用户帐户以便进行调试。



接下来转到安装Visual Studio的计算机并加载项目。右键单击解决方案资源管理器中的项目图标,然后选择"属性"。选择"调试"标签。对于"开始操作",选择"启动外部程序",然后选择"启动外部程序"。并输入winword.exe的完全限定路径,因为它存在于远程计算机上。点击"使用远程计算机"按钮复选框,并完全按照msvsmon窗口中显示的方式输入调试服务器的路径。通常,它类似于< domain> \< user> @< machine name>。



此时,您可以点击F5,Word应该在连接了调试器的远程计算机上启动。但是,您必须解决符号问题。如果您碰巧已将符号部署到远程计算机,则调试将正常工作。否则,您需要将符号路径设置为指向匹配符号所在的位置。要执行此操作,请转到"工具"。在Visual Studio中选择菜单,选择"调试",然后单击"符号"。并指定一个路径。一旦您的符号被整理出来,您就可以正常设置断点。假设您的加载项在Word启动时加载,您将按预期达到断点。如果你没有达到断点,请转到模块窗口,确认A)你的加载项确实加载了,并且B)符号随之加载。


< p align = left>


此致,


< tt>


Geoff Darst


Microsoft VSTO团队



Hi,

I've built a VSTO 2005 solution for Word that works perfectly in Word 2003, but fails in Word 2007. It's hard to fix the error without debugging, so my question is: Is there a way to debug a VSTO 2005 solution with running Word 2007? If not, what  would you suggest me?

Thanks.

解决方案

Hi Oleg,

 

Let me try to read between the lines here.  Since you are developing a customization that you expect to run on Word 2007, I'm assuming you have written an Add-In?  Presumably you are asking how to debug an Add-In that has been deployed to a machine that does not have Visual Studio on it.  Have I got it right?  I hope so, since VSTO 2005 document customizations aren't expected to run on Word 2007 (you'll need to upgrade to VSTO 3.0 when it ships).

 

If so, as long as the machines are networked, you can set up a remote debugging session.  To start with, you will want to copy Install path\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86\msvsmon.exe up to a share (Install path is %ProgramFiles% if Visual Studio was installed in the default location).  Then go to your target machine, connect to the share and run msvsmon.  You will need to open up your firewall to enable remote debugging; msvsmon will prompt you to do this when you start it up.  If you are logged on to the target machine with a different user account than the one you are debugging from, you will need to select Permissions on msvsmon and add your user account so you can debug.

 

Next go to the machine where you have Visual Studio installed and load up your project.  Right click the project icon in Solution Explorer and choose "Properties".  Select the "Debug" tab.  For "Start Action", select "Start external program" and enter fully qualified path to winword.exe as it exists on the remote machine.  Click the "Use remote machine" check box and enter the path to the debugging server exactly as it appears in the msvsmon window.  Typically, it will be something like <domain>\<user>@<machine name>.

 

At this point, you can hit F5 and Word should launch on the remote machine with the debugger attached.  However, you have to sort out the symbol issue.  If you happened to have deployed symbols to the remote machine, then debugging will just work.  Otherwise, you'll need to set your symbol path to point to a location where matching symbols reside.  To do this go to the "Tools" menu in Visual Studio, choose "Debugging", click "Symbols" and specify a path.  Once your symbols are sorted out, you can set breakpoints normally.  Assuming your add-in is loading when Word starts up, you will hit your break points as expected.  If you don't hit your break points, go to the modules window and verify that A) your Add-in really did load and B) symbols were loaded along with it.

 

Sincerely,

 

Geoff Darst

Microsoft VSTO Team

 


这篇关于如何使用Office 2007调试VSTO 2005解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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