当在程序中使用COM组件的coclass时候,会遇到“CoClass 'xx' can be used only as one of its applicable interfaces”的错误。

比如在使用Excel的时候使用如下的代码:

using Excel = Microsoft.Office.Interop.Excel;

Excel.Application excelApplication = new Excel.ApplicationClass();

 

在VS2010 Beta1的read me 文件里面有提到解决方法,方法就是不使用coclass,直接使用Application

Excel.Application excelApplication = new Excel.Application();

posted on 2010-01-20 14:32  gracestoney  阅读(265)  评论(0编辑  收藏  举报