- Microsoft Office Interop Excel Example Visual Basic
- Microsoft.office.interop.excel.dll
- Microsoft Office Interop Excel Location
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)
The Microsoft Office 2010 Primary Interop Assemblies (PIA) Redistributable is a Microsoft Windows Installer package that contains the Primary Interop Assemblies for Microsoft Office 2010 products. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. I have added reference of 'Microsoft.Office.Interop.Excel' dll in webApplication. In local its working fine. What is Microsoft.Office.Interop.Excel.dll? Microsoft.Office.Interop.Excel.dll is part of 2007 Microsoft Office system and developed by Microsoft Corporation according to the Microsoft.Office.Interop.Excel.dll version information. Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. I got solution by changing Excel.dll version. I was using 15.0.0.0 and now I changed it to 12.0.0.0 and its working fine. I got dll from Add reference > Browse > C: > Windows > assembly > GAC > Microsoft.Office.Interop.Excel > 12.0.0.0_etc > Microsoft.Office.Interop.Excel.dll. 'Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=10.0.4504.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.' I copied the files & registered to all locations i have on my local 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=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
files in Bin folder are:
一 加载文件或程序集“Microsoft.Office.Interop.Excel。。。 Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. 出现这个问题的原因有两个: 1、系统里没有安装“Excel 2003.
I've installed on remote pc 'Microsoft Office 2010: Primary Interop Assemblies Redistributable',http://www.microsoft.com/en-us/download/details.aspx?id=3508
But same error ocurrs.
How to resolve this issue?
Thanks.
ihorkoihorko4 Answers
ihorkoihorkoMicrosoft Office Interop Excel Example Visual Basic
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=14.0.0.0, 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:Windowsassembly 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:
- Add reference to Excel Interop Library(Assembly)
- Add Excel in
using
section - Now use it in your coding.
Microsoft.office.interop.excel.dll
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();
.