Recently deploying a WinForm project that uses the Office PIA, a log file for a machine has been reported System.IO.FileNotFoundException and a number of problems have been found.
The last discovery is that the Office PIA is not deployed.
Method One: Let the customer install Office by the way. NET programmability (. NET Programmability Support)
method Two: Deploy the necessary DLL files to the program execution directory
First, after we install the Office PIA on our development machine, we want to know which DLLs we all need. Not all DLLs are what we need.
For example, in my previous example, Office PIA: Code Sample: Excelapp class for generating Excel files:
The DLLs I need actually have only these three:
Microsoft.office.interop.excel.dll
Microsoft.vbe.interop.dll
Office.dll
In Visual Studio project, add a reference to these three DLLs (that is, the three references I marked with a red line):
Then, set the Copy Local property of the three references to True:
C#system.io.filenotfoundexception There may be no installation on the customer's machine Officepia