Home » excel » asp.net – Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=

asp.net – Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=

Posted by: admin April 23, 2020 Leave a comment


I have web-site that uses MS Excel files read/write.

I added related dll’s to Bin folder of the site, and it works perfect on my local host (I think bacause I have installed MS Excel 2010 on my pc)

But when I uploaded it to remote pc and run the site, it throws an error:

Could not load file or assembly ‘Microsoft.Office.Interop.Excel,
Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or
one of its dependencies. The located assembly’s manifest definition
does not match the assembly reference. (Exception from HRESULT:

files in Bin folder are:


I’ve installed on remote pc “Microsoft Office 2010: Primary Interop Assemblies Redistributable”,

But same error ocurrs.

How to resolve this issue?


How to&Answers:

One way – Install MS Office (MS Excel)


I know that this thread is a little bit old but I had the same error and I solved it (it works in my project).

In my web.config file I had assemblies added:

<add assembly="office, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"/> and many other office assemblies.

The thing I have done is that I have removed all the assemblies from web.config file and had added dlls as a reference – Microsoft.Office.Interop.Excel.dll in this case.

I am not an expert and I just thinking loudly that web.config file is trying to pull dll. file from C:\Windows\assembly\ and if there if it could not be foud, returns error.

You don’t have to install office or other unneccessary stuff on you server.

Hope this help someone.


you no need to install MS Office- 2010,
Add Reference -> COM-> “Microsoft office 12.0 Object Libaray”

its works for me.


Correct procedure to use Excel in C# Projects is:

  1. Add reference to Excel Interop Library(Assembly)
  2. Add Excel in using section
  3. Now use it in your coding.

The first step will work if you have Office(Excel) Installed in your PC. If not then install. Then add reference to Microsoft.Office.Interop.Excel of the version you need.

a. If list doesn’t shows the desire version then you may have another vision of Office with Excel installed. By The Way, you can use any.

b. If you don’t find anything like Microsoft.Office.Interop THEN may be office not installed OR you have Office 2013 or later. For higher version you can add assembly by going into COM tab of add-reference windows and add Microsoft Excel {version-no} Object Library. This will add the same.

c. If you already have Microsoft.Office.Interop... in References with yellow-triangle-mark THEN remove it first.

After that second step will totally work: using Excel=Microsoft.Office.Interop.Excel;

And finally as a third step you can create Excel object by Excel.Application xlApp = new Excel.Application();.