Source code: BillKrat/OpenLiveWriter (CodeSnippet)
It was great news that the Live Writer application was released as open source – initially there was some momentum behind it and as a result we have source code that we can easily compile in Visual Studio. Unfortunately, the revisions made rendered the existing plug-ins useless with no readily available documentation or process for being able to utilize them. This prompted me to start an adventure so that I could get my favorite “Code Snippet” plug-in back.
The source branch I reference in above link is my fork on GitHub where I compile it under Visual Studio 2017 after making some tweaks; more specifically – fixed issues that crashed the application’s internal processing.
In a nutshell to get the “Code Snippet” plug-in working you have to copy the SharedDll contents (OpenLiveWriter.BlogClient.dll) to the click once application folder (instructions below) and then copy the SharedInstall contents into the “Open Liver Writer” plug-in folder.
There are a couple of issues at play here that cause our plug-in dilemma:
- An exception in the blog providers causes the plug-in logic to be bypassed
- The plug-ins are compiled with an API that no longer exists – the namespace has changed.
Exception is thrown that causes logic to be bypassed (if applicable - above works with latest release)
If you were to download the source for my Visual Studio 2017 branch (reference link above) and search for “BillKrat” you will find the minor revisions made that permitted the application to run without internal crashes. Note: I did provide a pull request.
Below you’ll see that I remarked out a provider that was causing an exception to be thrown bypassing the logic that checks the Plug-ins folder (shown in image above). To resolve this you’ll need to replace the OpenLiveWriter.BlogClient.dll.
To replace the dll in the click-once application you can simply launch the application, load the Task Manager, right click on the executing application, and select “Open file location” as shown in the image below. Once opened in the file explorer you can replace the OpenLiveWriter.BlogClient.dll. Upon subsequent usage of the click-once application you will be able to load plugins from the plug-in folder.
The plug-ins are compiled with an API that no longer exists
Once I could get the dll to load from the open source code, it then crashed because the WIndowsLive.Writer.Api is no longer available, the namespace was changed to OpenLiveWriter.Api. This effectively breaks all existing plug-in code. My initial knee-jerk reaction was to get .NET Reflect (version 6 was a free version if you can still find it on the internet) and have it extract the code from the existing dll. I then removed the outdated reference, referenced the new OpenLiveWriter.Api project, fixed minor compile issues (from Reflector) and Walla! I had a functional code snippet plug-in. I later found that there are numerous open source plug-ins for Windows Live Writer that can downloaded, retro-fitted with the new OpenLiveWriter.Api and dropped into the applicable folder without having to use Reflector. Note: as of this writing I only use the Code Snippet plug-in.