Issue with Microsoft.Office.Interop.Word with Office 2010 with Visual studio 2015

0

I am working on a requirement to read the word document and populate data into Datatable or excel sheet using C# code.

I am using Visual Studio 2015 and Office 2016 in my machine. In my solution I have added the references Microsoft Word 16.0 Object Library to work with word documents. But when i deployed the solution production server Code is not working and I ma getting the error like

"System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Word.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))."

In Production we are using Office 2010. I think it is raising the issue because of compatibility issues between 2010 and 2016 references

Is this possible to add office 2010 reference from the system in which office 2016 is installed from visual studio 2015?

Could you please someone let me know how to fix this issue

c#
office-interop
com-interop

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0