FileNotFound on Excel.Application in c#

Viewed 29

Error message

I get this error when I am trying to read an Excel file, does anyone know why this is happening?

namespace UseCaseParser
{

    using Excel = Microsoft.Office.Interop.Excel;
    class Program
    {
        static void Main(string[] args)
        {
            Excel.Application xlApp = new Excel.Application();

        }
    }
}
1 Answers

This happened to me when I used wrong link reference.

Go to Links in Solution Explorer, search for "Interop" in Link manager and select Microsoft.Office.Interop.Excel V15.0.0.0

Rebuild your solution after you add new link.

Microsoft.Office.Interop.Excel Link

EDIT: Also, make sure, your VS version / .NET version is compliant.

Related