In my C# program, I am using Excel 2010 interop assembly. With this i am reading & writing data to excel file. And executing fine on dev box (contains Office 2010). On client machine, even though they have Office 2010 and Office PIA, there are seeing below exception, raises at WriteToExcel() method call.
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Type System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(System.GUID)'.
Below is my code snippet.
[STAThread]
static void Main(string[] args){
// read user input, process and write data to Excel
WriteToExcel();
}
[STAThread]
static void WriteToExcel(){
Application xlsApplication = new Application();
Workbook xlsWorkbook = xlsApplication.Workbooks.Open(excelFilePath);
// write data to excel
// close up
}
Issue solved after lowering .net version to 4.0. Earlier My devbox has 4.5 and application is compiled with this version. My client machine has 4.0 version, lowering .net version solved the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With