当在程序中使用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();
--------为懒人准备的回复方式,点击下面的按钮回复(请勿重复点击)-------
作者:gracestoney
出处:http://www.cnblogs.com/gracestoney/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
该文章也同时发布在我的csdn博客中-Gracestoney。