has no constructors defined

C#读写excel文件的问题
对于这句代码
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.ApplicationClass();
总是报异常

The type 'Microsoft.Office.Interop.Excel.ApplicationClass' has no constructors defined
Interop type 'Microsoft.Office.Interop.Excel.ApplicationClass' cannot be embedded. Use the applicable interface instead.

解决方法

项目的引用里面 Microsoft.Office.Interop.Excel 这个引用的属性 “嵌入互操作类型” 改为 False

posted @ 2013-10-08 16:09  树静风不止  阅读(504)  评论(0)    收藏  举报