The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft.Office.Tools.Excel'
Visual Studio 2010 VSTO Excel 2007 add-in project. Trying to build the solution i开发者_StackOverflow社区n Visual Studio I get the following:
The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft.Office.Tools.Excel' (are you missing an assembly reference?)
The project is referencing the following assembly: C:\Program Files\Reference Assemblies\Microsoft\VSTO\v9.0\Microsoft.Office.Tools.Excel.v9.0.dll
On my machine this assembly is Product Version 9.0.21022.8. On other developer machines where the project builds successfully the assembly is Product Version 9.0.30729.1.
What do I need to install to upgrade these assemblies to v30729?
Thanks, Tom
Apparently the answer is to install Microsoft Visual Studio 2008 Service Pack 1 (we're using VSTO v3.0) - http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en
This will upgrade the Microsoft.Office.Tools.Excel.v9.0.dll assembly to Product Version 9.0.30729.1 which includes the Extensions namespace.
This worked for me (Target framework: .NET Framework 4 Client Profile).
First read (VS 2010) https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.extensions.worksheetextensions(v=vs.100).aspx
Project > Add Reference... > Click .NET tab > Scroll down and Select "Microsoft.Office.Tools.Excel.v4.0.Utilities" > Click OK
References C:\Program Files\Reference Assemblies\Microsoft\VSTO40\v4.0.Framework\Microsoft.Office.Tools.v4.0.Framework.dll (Product version 10.0.40820.0)
精彩评论