c# - Excel interop MissingMethodException on some systems -


in c# program, using microsoft.office.interop.excel. reading & writing data excel file. on 1 machine, though has office 2007, there seeing below exception, raises @ getcomponentpath() method call.

unhandled exception: system.missingmethodexception: method not found: 'system.type system.runtime.interopservices.marshal.gettypefromclsid(system.guid)'.

here code:

public static string getcomponentpath(officecomponent _component) {     string toreturn = string.empty;     string _key = string.empty;     try     {         microsoft.office.interop.excel.application _excelapp = null;         _excelapp = new microsoft.office.interop.excel.application();         if (_excelapp != null)         {             console.writeline("excel installed");         }         else         {             console.writeline("excel not found.");         }                    }     catch (exception ex)     {         console.writeline("error \n" + ex.tostring());     }     return toreturn; }  public enum officecomponent {     word,     excel,     powerpoint,     outlook } 

problem : have developed application in local machine heigher version of .net framework , running same on remote pc having lower version of.net framework.

note : if target application run on heigher version of .net framework wont run on lower versions.

solution : need target .net framework lower version available on remote pc run on remote pc.

step 1: right click on project - select properties

step 2: change target framework .net framework x.x .net framework x.y.

note : x.x heigher , x.y lower version available on remote pc or lower version.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -