FileNotFoundException Could not load file or assembly 'office, Version=15.0.0.0

1

Im trying to parse a XLSM workbook,

I have linked using:

using Excel = Microsoft.Office.Interop.Excel;       //microsoft Excel 16 object in dependencies-> COM tab

Exception:

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified.
  Source=TrafficDataPrep
  StackTrace:
   at TrafficDataPrep.XLSMReader.ReadXLSM() in C:...Program.cs:line 287
   at TrafficDataPrep.SplitFiles.Main() in C:...Program.cs:line 27

And in Dependencies > addReference > COM I added a reference to Interop.Microsoft.Office.Interop.Excel. Which should support my excel version, my excel version is 16.0.12527.21296

Followed this to link the assembly for Excel.

Any ideas why its still throwing the error?

c#
excel
asked on Stack Overflow Nov 16, 2020 by SwimMaster

1 Answer

0

For some reason my .NET version was archaic. Updating to .NET 5 fixed the issue.

answered on Stack Overflow Nov 16, 2020 by SwimMaster

User contributions licensed under CC BY-SA 3.0