0

I have inherited a MS Excel addin project written in VS 2010 and because I have never written a VS addin before, I am somewhat confused as to why I cannot start it from the Visual Studio.

The project compiles without error, but when I attempt to start it, it says 'You cannot debug or run this project, because the required version of the Microsoft Office application is not installed'. I have MS Excel 365 installed and when I download the compiled addin installation pcakage, I can install and run the addin within my Excel alright.

From another question here, I understood that the reason could be that the .csproj file contains a different path to Excel (from the original's author machine) than what it needs to be on my machine.

In my .csproj file, under ProjectExtensions > VisualStudio elements, there's:

<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
  <ProjectProperties HostName="Excel" HostPackage="{20A848B8-E01F-4801-962E-25DB0FF57389}" OfficeVersion="14.0" VstxVersion="4.0" ApplicationType="Excel" Language="cs" TemplatesPath="" DebugInfoExeName="#Software\Microsoft\Office\14.0\Excel\InstallRoot\Path#excel.exe" AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
  <Host Name="Excel" GeneratedCodeNamespace="ConfigDBaddin" PublishedHash="69C324AB27932AA2FBF2B7EA72250886FF164DE6" IconIndex="0">
    <HostItem Name="ThisAddIn" Code="ConfigDBAddin.cs" CanonicalName="AddIn" PublishedHash="879FD8B71587DEEC71FFEFE50C6C4996636229AA" CanActivate="false" IconIndex="1" Blueprint="ConfigDBAddin.Designer.xml" GeneratedCode="ConfigDBAddin.Designer.cs" />
  </Host>
</FlavorProperties>

The registry path Software\Microsoft\Office\14.0\Excel\InstallRoot\Path#excel.exe doesn't even exist at all on my computer. I have a 14.0 and 15.0 sections in the Office section, but none of them contains an Excel section. I assume that I need to change this in the .csproj file to something, but am not sure to what.

What do I have to do to successfully launch the addin from VS?

Community
  • 1
  • 1
mzi
  • 307
  • 3
  • 10
  • Go to your project references, delete the missing Excel reference, add a reference to the Excel you do have installed, then re-compile the project. – João Mendes Sep 01 '14 at 14:26
  • @JoãoMendes My Excel is 15.0, so I replaced the `Microsoft.Office.Interop.Excel` reference with the 15.0.0.0 version, and then I have removed and reinserted the `Microsoft.Office.Tools.Excel` (version 10.0.0.0, the only one I have an option to select). However, I still have the same issue. – mzi Sep 01 '14 at 14:43
  • @JoãoMendes I haven't been entirely correct in the last comment. When I select the 15.0 version, I cannot even compile: `Assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' uses 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'` When I select a 14.0 version, the project compiles, but I cannot launch the addin. – mzi Sep 01 '14 at 14:46

1 Answers1

0

Changing the value in the .csproj file as suggested by this answer solved my issue. In my case, I had to change the 14.0 to 15.0.

Community
  • 1
  • 1
mzi
  • 307
  • 3
  • 10