且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Excel 2010加载项转换为2007加载项(均为VSTO)

更新时间:2023-12-05 20:01:04

要使 VS 2010 Office 2007 一起使用,请修改项目文件( .csproj ),以便将其打开在Office 2007中运行,而在运行时不查找Office 2010(因此出现以上错误消息)。

To get VS 2010 working with Office 2007 modify the project file (.csproj) so that it will open in Office 2007 and not look for Office 2010 when run (hence the error message above).

这是项目设置更改( Excel示例):

Here is the project settings change (Excel example):

源XPath:


// Project / ProjectExtensions / VisualStudio / FlavorProperties / ProjectProperties / @ DebugInfoExeName

//Project/ProjectExtensions/VisualStudio/FlavorProperties/ProjectProperties/@DebugInfoExeName

旧值(Office 2010):


DebugInfoExeName =#Software\Microsoft\Office\14.0\Excel\InstallRoot\Path#excel.exe

DebugInfoExeName="#Software\Microsoft\Office\14.0\Excel\InstallRoot\Path#excel.exe"

新值(Office 2007):


DebugInfoExeName =#Software\ \Microsoft\Office\12.0\Excel\InstallRoot
\Path#excel.exe

DebugInfoExeName="#Software\Microsoft\Office\12.0\Excel\InstallRoot \Path#excel.exe"

之后更改此项目设置后,在启动调试器( F5 )时,它将加载Excel 2007应用程序,而不是查找Excel2010。

After changing this project setting, when you fire up the debugger (F5) it will load the Excel 2007 application instead of looking for Excel 2010.