Failed to load file or assembly "Office, Version = 15.0.0.0"

I am using Vs2013. I created an application in which I use the Excel file as input and get contact with the file. Everything works on my computer. I have Vs2013. Windows 8.1, Office 2007 and 2013

When I run my application on any other computer, it throws

Failed to load file or assembly 'office, Version = 15.0.0.0, Culture = neutral, PublicKeyToken = 71e9bc111e9429c' or one of its dependencies. The system cannot find the specified file.

According to my application requirement, I need to use an Excel file from Office 2007 until 2013.

I mentioned several StackOverflow links, but I am not getting the result. I am stuck. Please suggest me how to solve this.

+5
source share
3 answers

The other version of Office must be installed on the other machine. 15.0.0.0 must match Office 2013, which must be installed on your target computer (other versions of Office may not work). This almost certainly means that you are using MSOffice interaction libraries, which work only if the office is installed and against the same version.

In addition, you can reorganize your code to just read the XML Excel file.

+4
source

I got the solution by changing the version of Excel.dll. I used 15.0.0.0 and now I changed it to 12.0.0.0 and it works fine. I got a dll from Add reference > Browse > C: > Windows > assembly > GAC > Microsoft.Office.Interop.Excel > 12.0.0.0_etc > Microsoft.Office.Interop.Excel.dll

+5
source

I created a batch file to fix this problem. See below script:

  echo off cls color 1f echo Checking for Administrator elevation. openfiles>nul 2>&1 if %errorlevel% EQU 0 goto isadmin COLOR 4f echo. You are not running as Administrator. echo. This tool cannot do it job without elevation. echo. echo. You need run this tool as Administrator. echo. echo.Press any key to continue . . . pause>nul exit :isadmin if exist c:\windows\assembly\GAC_MSIL\office\16.0.0.0__71e9bce111e9429c\OFFICE.DLL set officever=16 if exist c:\windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\OFFICE.DLL set officever=15 if exist c:\windows\assembly\GAC_MSIL\office\14.0.0.0__71e9bce111e9429c\OFFICE.DLL set officever=14 md c:\windows\assembly\GAC_MSIL\office\12.0.0.0__71e9bce111e9429c xcopy c:\windows\assembly\GAC_MSIL\office\%officever%.0.0.0__71e9bce111e9429c c:\windows\assembly\GAC_MSIL\office\12.0.0.0__71e9bce111e9429c /s/y pause 
0
source

All Articles