Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows Live Writer自动化_C#_Windows Live Writer - Fatal编程技术网

C# Windows Live Writer自动化

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

我希望能够从我的(C#)应用程序中打开Windows Live Writer,并填写一篇博客文章的开头

这应该很简单。Windows Live Writer定义了一个用于公开名为的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?) 
…除非它不起作用。不编译事件。相反,我会出现如下错误:

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");

}

我想说的是,现在已经是三年半之后了,我刚刚通过谷歌搜索找到了这篇关于同一个问题的帖子。我发现它很有用(它回答了我的问题)。所以我试着向上投票,并意识到问题和答案都是由我提出的!令人捧腹的我想说的是,现在已经是三年半之后了,我刚刚通过谷歌搜索找到了这篇关于同一个问题的帖子。我发现它很有用(它回答了我的问题)。所以我试着向上投票,并意识到问题和答案都是由我提出的!令人捧腹的