Program using LinqToExcel works on my computer but after publishing and installation on another one it does not

353 views Asked by At

Published and installed program using LinqToExcel throws an "Exception has been thrown by the target of an invocation" exception. Inner exeption is not displayed but on my computer if I run exe file separately w/o another source files there is Could not load file or assembly linqtoexcel. but it is only on my PC when I tried to run it separately. But I beleave it is similar?

Both PCs are Win10, Access DB Engine 64bits or 64bits Offices are installed.

public void ImportNewData(String file) 
    {

    ExcelConnector excel = new ExcelConnector(file);

    foreach(var result in excel.ReadNewData()) 
    {
        this.loopsList.Add((Loop) result);
    }
}

public IEnumerable ReadNewData() {
    try 
    {
        var query = from a in this.ExcelConnection.Worksheet < Loop > ("Data")
        select a;

        return query;
    } 
    catch (Exception exeption) 
    {
        MessageBox.Show(exeption.Message + "\n" + exeption.InnerException.Message + "\n" + exeption.InnerException.Source, "Warning");
        return null;
    }

}

I expect it will run on any Windows machine :)

1

There are 1 answers

0
Jan Daliba On

I unchecked this check box and now it works also with 64bit Office.

32