我希望能夠從我的(C#)應用程序中打開Windows Live Writer,並且已經開始填寫博客文章。Windows Live Writer自動化
這應該很簡單。 Windows Live Writer定義了一個Application API,它公開了一個名爲WindowsLiveWriterApplicationLib的COM接口。根據this等博客文章,在向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?)
它聲稱的類不能被嵌入,有沒有構造,並且不包含我打電話的方法。 (當它在對象資源管理器中清楚地實現時)。
我在這裏丟失了什麼明顯的東西?
爲什麼downvote? –