Whether you’ve written Live Writer plug-ins before, or if you’re just thinking about writing your first, hopefully this post will give you some good tips that will help you build that new plug-in.
Use A Visual Studio Template
I would highly recommend downloading a Visual Studio template. The template can be downloaded for machines running x86 or x64 flavours of Windows (for VB.NET devs, downloads are x86 and x64). The reason I have done ones for both architectures is because otherwise you have to remove and then re-add the reference to WindowsLive.Writer.Api.dll as it will be looking in the wrong Program Files folder. The template itself is based on a combination of templates written by myself and Ben Hall.
To install the template, download the zip file above for which ever architecture of Windows you’re running, rename the zip to be called LiveWriterPlugin.zip, and put it in your template folder (by default this will be %VisualStudioFolder%\Templates\ProjectTemplates\Visual C#\ or Visual Basic if using the VB template). When you then go to create a new project, you will be given a new project type to choose from:
This will create a new project with a default plug-in type of ContentSource, although this can be changed to whichever type of plug-in you’re wanting to create. I am hoping that I can create something better for templates, but for now, this will suffice.
Note: All these templates will work with all flavours of Visual Studio from 2005 up to and including 2010 (including Express editions).
Make Sure The Plug-in Copies Automatically To The Plugin Folder
If you’re using the template from above, then you can skip this tip. Right click your plug-in’s project and go to the properties, in the Build Events tab have this: XCOPY /D /Y /R "$(TargetPath)" "C:\Program Files (x86)\Windows Live\Writer\Plugins\" (removing the (x86) reference if you’re on an x86 OS), so you should see this:
What this will do is every time you build your project, it will put that latest build in your Live Writer plugins folder so when Live Writer is opened, you will already have the latest copy loaded. This proves handy for the next tip.
Run Live Writer When Debugging Plug-ins
Because Live Writer plug-ins are just dlls, it makes it somewhat more difficult to actually debug them, however, with just a simple change to the project’s properties (again), we can make this oh so easy. In the debug section of our project’s properties, we set it to open an external program, in our case Live Writer itself which is at C:\Program Files (x86)\Windows Live\Writer\WindowsLiveWriter.exe.
By doing this, we get full debug capabilities of our plug-in.
Add Plug-in Options to the QAT (Wave 4 and newer)
With the latest beta of Live Writer, we have been given the Ribbon UI that has been present in Office for a few years now. One of the features of this is the Quick Access Toolbar (QAT) and you can pin just about any command from Live Writer to the Ribbon (except your own plug-in). One of the things you can pin to the Ribbon is the button for the plug-in options. Normally, this is in the Insert tab as seen below:
What this actually means is if your plug-in as options and you’re making sure this works ok, it gives you really quick access to those options (clue is in the name I guess) as it opens the Live Writer options on the plug-in page.
So there’s my list of top tips when it comes to developing Live Writer plug-ins. Do you have any of your own? If so, do please share them in the comments.