C# Windows Live Writer自动化
我希望能够从我的(C#)应用程序中打开Windows Live Writer,并填写一篇博客文章的开头 这应该很简单。Windows Live Writer定义了一个用于公开名为的COM接口的。根据博客文章,例如,在添加对typelib的新引用(通常位于此处:C:\Program Files(x86)\Windows Live\Writer\WindowsLiveWriter.Application.tlb)后,您应该能够编写如下代码:C# Windows Live Writer自动化,c#,windows-live-writer,C#,Windows Live Writer,我希望能够从我的(C#)应用程序中打开Windows Live Writer,并填写一篇博客文章的开头 这应该很简单。Windows Live Writer定义了一个用于公开名为的COM接口的。根据博客文章,例如,在添加对typelib的新引用(通常位于此处:C:\Program Files(x86)\Windows Live\Writer\WindowsLiveWriter.Application.tlb)后,您应该能够编写如下代码: static void Main(string[] arg
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?)
…除非它不起作用。不编译事件。相反,我会出现如下错误:
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?)
它声明该类不能被嵌入,没有构造函数,并且不包含我正在调用的方法。(当它在对象资源管理器中明确显示时。)
我在这里遗漏了什么明显的东西?设法让它工作起来 最后,我不得不使用RegSvr32.exe注册WindowsLiveWriter.Application.dll。之后,它开始工作 以下是工作代码:
static void Main(string[] args)
{
WindowsLiveWriterApplication wlw = new WindowsLiveWriterApplication();
((IWindowsLiveWriterApplication2)wlw).BlogThisHtml("test", "testhtml");
}
设法使它工作起来 最后,我不得不使用RegSvr32.exe注册WindowsLiveWriter.Application.dll。之后,它开始工作 以下是工作代码:
static void Main(string[] args)
{
WindowsLiveWriterApplication wlw = new WindowsLiveWriterApplication();
((IWindowsLiveWriterApplication2)wlw).BlogThisHtml("test", "testhtml");
}
我想说的是,现在已经是三年半之后了,我刚刚通过谷歌搜索找到了这篇关于同一个问题的帖子。我发现它很有用(它回答了我的问题)。所以我试着向上投票,并意识到问题和答案都是由我提出的!令人捧腹的我想说的是,现在已经是三年半之后了,我刚刚通过谷歌搜索找到了这篇关于同一个问题的帖子。我发现它很有用(它回答了我的问题)。所以我试着向上投票,并意识到问题和答案都是由我提出的!令人捧腹的