How to reference Microsoft.Office.Interop.Excel dll?
c#, excel, reference, visual-studio-2012, vsto
Solution
Use NuGet (VS 2013+):
The easiest way in any recent version of Visual Studio is to just use the NuGet package manager. (Even VS2013, with the NuGet Package Manager for Visual Studio 2013 extension.)
Right-click on "References" and choose "Manage NuGet Packages...", then just search for Excel.
VS 2012:
Older versions of VS didn't have access to NuGet.
- Right-click on "References" and select "Add Reference".
- Select "Extensions" on the left.
- Look for `Microsoft.Office.Interop.Excel`. (Note that you can just type "excel" into the search box in the upper-right corner.)
VS 2008 / 2010:
- Right-click on "References" and select "Add Reference".
- Select the ".NET" tab.
- Look for `Microsoft.Office.Interop.Excel`.
Problem
I had developed a system that deals with excel sheets in 2006 using MS VS 2005. Now, I can not use the same reference with MS VS 2012. ``` var app = new Microsoft.Office.Interop.Excel.Application(); Workbooks wbs = app.Workbooks; ```