当在程序中使用COM组件的coclass时候,会遇到“CoClass 'xx' can be used only as one of its applicable interfaces”的错误。
比如在使用Excel的时候使用如下的代码来创建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();