在我的MVC 5應用程序中,我想使用Microsoft.Office.Interop.Excel
庫。我使用了Visual Studio 2013和Office 2013.我添加了一個參考Microsoft.Excel 15.0 Object Library
,並在我的課程中添加了using Excel = Microsoft.Office.Interop.Excel;
當我點擊build
時,它不顯示任何錯誤並告訴Build Complete
,但是當我運行我的應用程序時,出現此錯誤使用Excel = Microsoft.Office.Interop.Excel編譯錯誤
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1748: Cannot find the interop type that matches the embedded interop type 'Microsoft.Office.Interop.Excel.Application'. Are you missing an assembly reference?
Source Error:
[No relevant source lines]
Source File: Line: 0
它可能是什麼?
你什麼時候跑這個? –
我正在運行 – Bryuk
爲什麼在使用類似OpenXML或更好的ClosedXML時使用interop?除非你需要使用XLS文件而不是XLSX,否則Office Interop並不是最好的選擇,尤其是當你在同一時間使用像MVC5一樣酷的東西! – JMK