convert an Excel 2010 addin to a 2007 addin (both VSTO)

前端 未结 2 671
不思量自难忘°
不思量自难忘° 2021-01-11 20:53

I am currently working on an Excel 2010 add-in which formerly was an Excel 2007 add-in. Somewhere in the process of switching computers, the add-in was converted i think.

相关标签:
2条回答
  • 2021-01-11 21:18

    Typically, when I am developing against multiple versions of Office with VSTO Add-ins, I have a project for each version of Office I am targeting. I put all common code between the projects into a single project (typically the oldest project) and use linked files, I add the common files to the newer projects. This allows me to write one set of common core code, abstracted from the requirements of each version of Office. This means I am no longer fighting the different ways VSTO is compiled for each version of Office. This can be made easier with shared folders and virtual machines, so I can develop and test without multiple computers. It is by no means graceful, but it works well for me. This should allow you to develop your VSTO Add-in against both Office 2007 and Office 2010 without much issue.

    0 讨论(0)
  • 2021-01-11 21:20

    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).

    Here is the project settings change (Excel example):

    Source XPath:

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

    Old Value (Office 2010):

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

    New Value (Office 2007):

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

    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.

    0 讨论(0)
提交回复
热议问题