3

I am using C# Winforms and when I add a reference to the project for Microsoft.Interop.Office.Excel v12.0.0.0, it automatically adds a COM reference to C:\Program Files\Microsoft Office\Office14\EXCEL.exe.

This .exe isn't found on any other machines, and as such, it won't work on other devices. Is there a way to import that file, or make it not reference to that file?

3
  • 6
    using office interop requires office to be installed. there are numerous 3rd party libraries that can read/write excel files. May 20, 2014 at 13:32
  • You could use late binding (which is pretty comfortable way now with dynamic types). You can then determine if excel is not installed and your software will run correctly (without being able to use excel though). Another plus, you software may work with other excel versions.
    – Sinatr
    May 20, 2014 at 13:43
  • How does one do a late binding? May 20, 2014 at 14:33

1 Answer 1

1

Any microsoft office tools like Microsoft.Office.Interof.Excel are part of Microsoft Primary Interop Assemblies called PIA, which can be downloaded separately and installed on production machine.

All version of PIAs can be downloaded from msdn. e.g. Office PIA

Msdn Pia link

Or you can copy them to Library Folder in your solution and reference these assembly from Library folder local to your solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.