无法调试或运行Word加载项,因为未安装所需的Microsoft Office版本 [英] Cannot debug or run Word AddIn because the required version of Microsoft Office is not installed

查看:823
本文介绍了无法调试或运行Word加载项,因为未安装所需的Microsoft Office版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要处理一个现有的Word 2007 addIn项目,该项目是MSVS 2008解决方案的一部分.但是,当我尝试调试addIn时,出现以下错误消息:您无法调试或运行此项目,因为未安装所需版本的Microsoft Office应用程序".我已经安装了Office 2007.

I need to work on an existing Word 2007 addIn project that's a part of a MSVS 2008 solution. However, when I try to debug the addIn, I get the following error message: "You cannot debug or run this project, because the required version of the Microsoft Office application is not installed". I have Office 2007 installed.

我尝试在相同的解决方案中创建一个新的Word 2007 addIn项目,并且调试它没有问题.据我所知,这两个项目之间所有引用的Office程序集都是相同的.

I tried creating a new Word 2007 addIn project in the same solution, and I have no problem debugging it. As far as I can tell, all the referenced Office assemblies are the same between these two projects.

引用的Office程序集:

Referenced Office assemblies:

Microsoft.Office.Interop.Word(c:\ Program Files(x86)\ Microsoft Visual Studio 9.0 \ Visual Studio Tools for Office \ PIA \ Office12 \ Microsoft.Office.Interop.Word.dll)

Microsoft.Office.Interop.Word (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office12\Microsoft.Office.Interop.Word.dll)

Microsoft.Office.Tools.Common.v9.0(c:\ Program Files(x86)\ Reference Assemblys \ Microsoft \ VSTO \ v9.0 \ Microsoft.Office.Tools.Common.v9.0.dll)

Microsoft.Office.Tools.Common.v9.0 (c:\Program Files (x86)\Reference Assemblies\Microsoft\VSTO\v9.0\Microsoft.Office.Tools.Common.v9.0.dll)

Microsoft.Office.Tools.v9.0(c:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ VSTO \ v9.0 \ Microsoft.Office.Tools.v9.0.dll)

Microsoft.Office.Tools.v9.0 (c:\Program Files (x86)\Reference Assemblies\Microsoft\VSTO\v9.0\Microsoft.Office.Tools.v9.0.dll)

Microsoft.Office.Tools.Word.v9.0(c:\ Program Files(x86)\ Reference Assemblys \ Microsoft \ VSTO \ v9.0 \ Microsoft.Office.Tools.Word.v9.0.dll)

Microsoft.Office.Tools.Word.v9.0 (c:\Program Files (x86)\Reference Assemblies\Microsoft\VSTO\v9.0\Microsoft.Office.Tools.Word.v9.0.dll)

Office(c:\ Program Files(x86)\ Microsoft Visual Studio 9.0 \ Visual Studio Tools for Office \ PIA \ Office12 \ Office.dll)

Office (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office12\Office.dll)

stdole c:\ Program Files(x86)\ Microsoft Visual Studio 9.0 \ Visual Studio Tools for Office \ PIA \ Office11 \ stdole.dll

stdole c:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\stdole.dll

我尝试重建,在调试"和发布"配置下都开始调试.没有任何帮助.我还有什么遗漏的地方,可能会导致调试旧项目时出现问题?

I tried rebuilding, starting debug under both Debug and Release configurations. Nothing helps. What else am I missing that could cause a problem with debugging the old project?

推荐答案

显然,在创建外接程序项目时,将保存调试信息,例如 MS Office 版本和用于调试的可执行路径.在.CSPROJ文件中.

Apparently, when the addin project is created, debug information such as the MS Office version and the executable path used for debugging is saved in the .CSPROJ file.

因此,不能保证调试可在另一台计算机上工作.

So debug is not guaranteed to work on another machine.

此信息保存在项目文件的以下XML节点中:

This information is saved in following XML node of the project file:

ProjectExtensions \ VisualStudio \ FlavorProperties \ ProjectProperties

ProjectExtensions \ VisualStudio \ FlavorProperties \ ProjectProperties

就我而言,问题出在属性上

In my case, the problem was in the attributes

  • OfficeVersion="14.0"
  • DebugInfoExeName="#Software\Microsoft\Office\14.0\Word\InstallRoot\Path#WINWORD.EXE"
  • OfficeVersion="14.0"
  • DebugInfoExeName="#Software\Microsoft\Office\14.0\Word\InstallRoot\Path#WINWORD.EXE"

将值从14.0更改为12.0(2010到2007)解决了我的问题.

Changing 14.0 to 12.0 (2010 to 2007) in their values solved my problem.

查看以下问题以供参考:

Check out these questions for reference:

  • Determine Excel 2007 addin vs excel 2010 addin
  • convert an Excel 2010 addin to a 2007 addin (both VSTO)

这篇关于无法调试或运行Word加载项,因为未安装所需的Microsoft Office版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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