Cannot debug or run Word AddIn because the required version of Microsoft Office is not installed

22,818

Solution 1

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.

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

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"

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

Check out these questions for reference:

Solution 2

For the benefit of searchers, I hit this error in Visual Studio despite referencing the correct version in the section mentioned by @sdds.

For me the fix was:

  1. Go to the project properties in visual studio
  2. Go to the 'Debug' tab
  3. Click the 'Start External Program' radiobutton
  4. Enter the path to the Office Application e.g. C:\Program Files\Microsoft Office 15\root\office15\winword.exe
  5. Run the project.
Share:
22,818

Related videos on Youtube

sdds
Author by

sdds

Updated on July 09, 2022

Comments

  • sdds
    sdds almost 2 years

    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.

    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.

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

    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?

  • Watson
    Watson over 10 years
    Exactly my issue when moving to a new development machine. Opened the .csproj file with notepad and changed 15 to 14 (Office 365 to Office 2010).
  • anhoppe
    anhoppe over 10 years
    Can't believe it, it worked. I had the case Outlook 2010 on one machine, 2013 in the other (changed version 14.0 to 15.0). Thank you.
  • illagrenan
    illagrenan about 10 years
    Works for PowerPoint 2013 -> 2010.
  • Steven C. Britton
    Steven C. Britton almost 10 years
    Thanks for this. Works when rolling back to Excel 2010 from Excel 2013.
  • mzi
    mzi over 9 years
    Worked for me as well, replaced 14.0 with 15.0 and works like a charm.
  • personne3000
    personne3000 about 9 years
    In VS2013, changing OfficeVersion to 12 for Office 2007 did not work (VS repeatedly asked to upgrade the project file). Changing only the DebugInfoExeName attribute made the trick.
  • Wade Hatler
    Wade Hatler almost 9 years
    I ran into this when a project seemingly wouldn't build after refreshing the project tree. Turns out it's been broken a long time but I have had the explicit EXE in the Debug tab for ages because I pass commandline parameters to Word. Those are stored in *.csproj.user, and I hadn't saved the .user file in the repository.
  • punkouter
    punkouter over 8 years
    this was a fix for me I needed when going between Excel 2016/2013
  • X-Coder
    X-Coder over 8 years
    It works for me too :) in my case I changed DebugInfoExeName="#Software\Microsoft\Office\15.0\Word\Insta‌​llRoot\Path#WINWORD.‌​EXE" to DebugInfoExeName="#Software\Microsoft\Office\12.0\Word\Insta‌​llRoot\Path#WINWORD.‌​EXE" for MS Word 2007 I installed
  • interesting-name-here
    interesting-name-here about 8 years
    Fix for me going 2013 to 2016, same as @punkouter
  • kmote
    kmote about 8 years
    or C:\Program Files (x86)\Microsoft Office 2013\Office15\winword.exe
  • Marcos Brigante
    Marcos Brigante almost 8 years
    Office 2013 to 2016 change version from 15 to 16
  • broadband
    broadband over 7 years
    Worked for me. Plugin was developed/tested with Office Outlook 2016 and I'm running Office Outlook 2013. Just changed external program to point to my C:\Program Files\Microsoft Office\Office15\OUTLOOK.exe.
  • ptownbro
    ptownbro almost 7 years
    This is the correct answer in my opinion. You shouldn't have to go the .csproj (or .vbproj file for VB) and should be able to use the GUI