I use Vs2013. I have created application in which I use Excel file as an input and get contact from the file.
Everything is working in my computer. I have Vs2013. Windows 8.1, Ms office 2007 & 2013.
When I run my application in any other computer, it throws
Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bc111e9429c' or one of its dependencies. The system cannot find the file specified
As per my application requirement, I need to use Excel file from Office 2007 to 2013.
I have referred few StackOverflow links but I am not getting result. I am stuck. Please suggest me how to solve this.
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
Your other machine needs to have the corresponding version of Office installed. 15.0.0.0 should correspond to Office 2013 - that needs to be installed on your target machine (other versions of Office may not work). This almost certainly means you're using MSOffice interop libraries, which only work if office is installed and against the same version.
Alternatively, you could refactor your code to just directly read the Excel XML.
I created a batch file to fix this issue. See script below: