Thursday, June 24, 2010

The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)


After installing Visual Studio 2010 on the new server I found this error.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1360): Could not resolve this reference. Could not locate the assembly "Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

I had a project referencing Microsoft.Office.Interop.Excel.dll with the path
C:\Program Files\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.Office.Interop.Excel.dll
If you did not installed the office tools for visual studio 2010 you can download the PIA VSTO Install here http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=06c32242-2289-4471-93aa-ce96aa5cbc36

I went to the project and updated the reference to use the new path for VS.NET 2010 using
%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14 and it compiled perfectly fine.



1 comment:

  1. Many thanks for this post!
    I had the same problem but could fix it due to your sharing this valuable information.

    Regards,
    Joe

    ReplyDelete