如何在控制台应用程序上导入Microsoft.Office.Interop.Excel?

use*_*874 2 vb.net excel console-application office-interop

它可以在我的网站应用程序上正常工作,但是我也必须在将从任务计划程序运行的控制台应用程序上使用它。

这就是我所谓的导入方式:

Imports Excel = Microsoft.Office.Interop.Excel
Run Code Online (Sandbox Code Playgroud)

问题是当我尝试从控制台应用程序导入它时,出现以下错误:

Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found
Run Code Online (Sandbox Code Playgroud)

关于如何解决这个问题的任何想法?谢谢。

And*_*eev 5

你应该Add ReferenceMicrosoft.Office.Interop.Excel组件