我希望能够从我的 (C#) 应用程序中打开 Windows Live Writer 并填写博客文章的开头部分。
这应该很简单。Windows Live Writer 定义了一个应用程序 API ,它公开了一个名为WindowsLiveWriterApplicationLib的 COM 接口。根据诸如此类的博客文章,在添加对 typelib 的新引用(通常位于此处:C:\Program Files (x86)\Windows Live\Writer\WindowsLiveWriter.Application.tlb)后,您应该能够编写代码像这样:
static void Main(string[] args)
{
var wlw = new WindowsLiveWriterApplicationLib.WindowsLiveWriterApplicationClass();
wlw.BlogThisHtml("test","test");
}
...除了它不起作用。不编译事件。相反,我得到这样的错误:
Error 1 The type 'WindowsLiveWriterApplicationLib.WindowsLiveWriterApplicationClass' has no constructors defined
Error 2 Interop type 'WindowsLiveWriterApplicationLib.WindowsLiveWriterApplicationClass' cannot be embedded. Use the applicable interface instead.
Error 3 'WindowsLiveWriterApplicationLib.WindowsLiveWriterApplicationClass' does not contain a definition for 'BlogThisHtml' and no extension method 'BlogThisHtml' accepting a first argument of type 'WindowsLiveWriterApplicationLib.WindowsLiveWriterApplicationClass' could be found (are you missing a using directive or an assembly reference?)
它声称该类不能嵌入,没有构造函数,并且不包含我正在调用的方法。(当它在对象资源管理器中明确时。)
我在这里缺少什么明显的东西?