Visual Studio Referencing

2019-07-06 22:16发布

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?

1条回答
戒情不戒烟
2楼-- · 2019-07-06 22:50

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.

查看更多
登录 后发表回答