What reference do I need to use Microsoft.Office.Interop.Excel in .NET?

I am interested in using C# to manipulate/Automate Excel files.

After browsing the web I have found VSTO but it seems you can not use that in Visual Studio Express Edition so I can not use that.

Just few minutes ago I noticed a question in this site that used this namespace in its code:

Microsoft.Office.Interop.Excel

So I am wondering if all I need to use that is add necessary reference and if so which reference to add?

UPDATE

I installed "Primary Interop Assemblies" as the accepted answer suggested but for some reason they are still missing in the Add Reference dialog under ".NET" but they are present in GAC.

So I just added the reference using "Browse" and located Microsoft.Office.Interop.Excel.dll in GAC folder.

But looking for similar questions on this site regarding adding reference from GAC it seems this is not recommended.


Update (thanks user2347528)

These assemblies are available as NuGet packages, which is much easier than my original answer.

You can install by either right clicking on References in your project and selecting Manage NuGet packages... and searching for one of the packages listed below, or install using the Package Manager Console:

PM> Install-Package Microsoft.Office.Interop.Excel
  • Microsoft.Office.Interop.Excel
  • Microsoft.Office.Interop.Word
  • Microsoft.Office.Interop.Outlook
  • Microsoft.Office.Interop.PowerPoint
  • Microsoft.Office.Interop.Graph

These are available as "Primary Interop Assemblies", which can be installed with Office, or downloaded and installed separately. How to: Install Office Primary Interop Assemblies.

Once those are installed, you can reference them in your project in the Add Reference dialog, under .NET. If you do not see those Microsoft.Office.Interop assemblies listed, then they have not been installed yet. Install them from your setup, or download and install them separately (see my link above for the downloads).


Just had this problem myself and accepted answer didn't help me but I solved it with:

Add reference > Browse > C: > Windows > assembly > GAC > Microsoft.Office.Interop.Excel > 12.0.0.0_etc > Microsoft.Office.Interop.Excel.dll


Answers didn't help me to solve my problem, I couldn't find (and browse) the assemblies although I installed them using Microsoft's msi installer. For me, the excel assembly is located under C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll