Quantcast
Channel: Archimedes Trajano » programming
Viewing all articles
Browse latest Browse all 10

Creating a Windows Live Writer Plugin for free

$
0
0

Windows Live Writer is my blog software of choice, it has most of the features I would want out of the box, though I still need a few tweaks, primarily a way of marking text as <code> or insert code blocks in <pre> with as little effort as possible.   So I decided to write my own plugin to do it and being frugal, I chose to use Visual Studio Express 2012 for Windows Desktop.

Before going through this, I tried to look for a plugin that would do what I needed in the Windows Live Writer plugin directory, but I didn’t find one that I would really like. For the most part I saw a few plugins that do the <pre> wrapping , but they all involved prettifying the code as well which I didn’t need since I use the Crayon Syntax Highlighter plugin.  However,  I couldn’t find one that would evidently do <code>.

Prep work

So first step is to install Windows Live Writer and the IDE (make sure to choose Windows Desktop not Windows 8).  Now Microsoft did create instructions on how create a plug-in, though it is out-dated and won’t work as is on current versions.  This post seeks to remedy that.

First step is to start a new project

image

Then choose Class Library and give it a name.  In this case I called it TechBlogPlugin which is available on GitHub,

image

Since this will be a project using Git, I created the following .gitignore file to start things off.

*.suo
TechBlogPlugin/bin/
TechBlogPlugin/obj/

Press Alt-F7 to bring up the project properties and choose .NET Framework 2.0 as the Target Framework.  A dialog confirming the project would need to be re-opened will pop up.

image

Click on the Build tab and change the target to x86 only for all configurations.

image

Now in Solution Explorer highlight the ones that have a warning sign since those are not available in .NET Framework 2.0f using Ctrl-click and press Delete:

image

Right click on References and choose to Add Reference…

image

Click on Browse and use C:\Program Files (x86)\Windows Live\Writer\WindowsLive.Writer.Api.dll.  If you still have a 32-bit system then you have to take out (x86), then press OK.

Then go to Assemblies -> Framework and check System.Windows.Forms, then press OK.

image

Next steps

At this point everything is now ready to start coding which will be discussed on the next part of the series.  In the mean time all code sources are available on GitHub and tagged as baseline.

For now remove the following lines from Class1.cs in order to get the build working with F7.

using System.Linq;
using System.Threading.Tasks;


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles



Latest Images