簡體   English   中英

使用 LinqToExcel 的程序可以在我的電腦上運行,但在另一台電腦上發布和安裝后就不行了

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

使用 LinqToExcel 發布和安裝的程序會引發“調用目標已引發異常”異常。 內部排除不顯示,但在我的計算機上,如果我單獨運行 exe 文件而沒有其他源文件,則會出現無法加載文件或程序集 linqtoexcel。 但當我嘗試單獨運行它時,它僅在我的 PC 上。 但我相信它是相似的嗎?

兩台PC都是Win10,安裝了Access DB Engine 64bits或64bits Office。

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;
    }

}

我希望它可以在任何 Windows 機器上運行:)

我取消選中此復選框,現在它也適用於 64 位 Office。

32

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM