Welcome to MSDN Blogs Sign in | Join | Help

Developing Live Writer PlugIns with Edit-and-Continue

I was playing around with Live Writer's (WLW) PlugIn API and am really impressed.  It's clean, hassle-free, and very easy to write an PlugIn, and WLW appears to export a good set of services for plugins to consume.  (Check out the WLW PlugIn gallery for plugins).

 

The basic gist is you just need to write a single class that derives from WindowsLive.Writer.Api.ContentSource (which is included in the LiveWriter download), and then copy it into the Plugins subdirectory under Live Writer's install.

There are more complete instructions on MSDN at http://msdn2.microsoft.com/en-us/library/aa702851.aspx.

But it gets better! The instructions there conclude with:

"7. Build your plugin and then run Windows Live Writer to test and debug."

But you can do the debugging under Visual Studio and fully leverage the VS debugger, including Edit-and-Continue. Just specify Live Writer as the startup project to launch.

Specifically, under "Solution Properties : Debug : Start Action", choose "Start External program" and select WindowsLiveWriter.exe (probably "C:\Program Files\Windows Live Writer\WindowsLiveWriter.exe").

Now if you F5, LiveWriter spins up and loads your extension.

And then you can debug your extension once WLW invokes it, and you can even use Edit-and-Continue to develop and debug your PlugIn.

 

Note this is the same technique that I mentioned for debugging PowerShell cmdlets under the VS IDE. (see that entry for a screenshot of where the "Start External Program" option is.)

 

An example:

You can literally write a 20 line plug-in. Here's a really lame example that converts all URLs to uppercase when you paste them into WLW.  

using System;
using WindowsLive.Writer.Api;

namespace MyLiveWriterExt
{
    // Plugin to take all URLs and convert them to all uppercase.
    [WriterPluginAttribute("{5dc7327d-6a8e-4609-aec0-719cb5db79e8}", "Dummy Plugin", PublisherUrl="http://blogs.msdn.com/jmstall")]
    [UrlContentSource("http://*")]
    public class MyExt : ContentSource
    {
        
        public override void  CreateContentFromUrl(string url, ref string title, ref string newContent)
        {
            newContent = url.ToUpper();
        }
    }
}

 

This also makes me think about Mdbg's (C# command line debugger) plug-in model, and WLW's is definitely cleaner.

Published Thursday, July 26, 2007 1:00 PM by jmstall

Comments

# Interesting Finds: July 27, 2007

Friday, July 27, 2007 8:38 AM by Jason Haley

# My first (non-trivial) Windows Live Writer Plugin

Friday, August 03, 2007 1:26 AM by Mike Stall's .NET Debugging Blog

So the Live Writer Plugin model is so cool and easy that I had to write a plugin. (and do it with Edit-and-Continue

# WiX Script for installing Live Writer Plugins

Saturday, October 27, 2007 2:47 AM by Noticias externas

Here's a WiX install script to build an MSI to install a Windows Live Writer (WLW) plugin dll, by

# Windows Live Writer 2008 is now available

Tuesday, November 06, 2007 10:47 PM by Buck Hodges

The first version of Windows Live Writer is now available. I've been using the betas for a long time,

# Windows Live Writer 2008 is now available

Tuesday, November 06, 2007 11:10 PM by Noticias externas

The first version of Windows Live Writer is now available. I've been using the betas for a long time

New Comments to this post are disabled
 
Page view tracker