Search code examples
excel.net-coreoffice-interop.net-standard

How to solve Microsoft.Office.Interop.Excel .net Standard "Could not load file or assembly" Exception?


I've checked many posts and references about this but still cannot solve it.

I have a .Net Standard project that references Microsoft.Office.Interop.Excel. Everything is fine up until the runtime where I want to initiate an excel (read and/or write) and I get this exception:

'Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified

It works fine on .NET Framework 4.6.1 but it does not on .net core and standard.

Her is my GAC enter image description here

What do I do to fix this?


Solution

  • I found out that it was because I use .NET Core. I should use COM reference too.

    The answer that helped me is here .NET core 3.0 and MS Office Interop