In a previous posts I’ve been blogging about my efforts to use blog tools in Windows Live writer in conjunction with a blog hosted on Sharepoint Server. One of the best tools I found for blogging as a programmer was jp-SyntaxHighlighter. I tell you all about the minor modifications you have to make to the project here. And here is an example of what it can do
function FindTagsByName(list, name, tagName) {
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++)
if (tags[i].getAttribute('name') == name
|| tags[i].getAttribute('title') == name)
list.push(tags[i]);
}
So Monday I installed the new Windows 7 RC. Which I am REALLY liking, not the least because I had the OS installed and all my required core development support up and configured in 1 day! So today I decided to make a new blog entry (about C# needing a Select Case structure like in VB, switch just doesn’t cut it), when I discovered I hadn’t installed my Live Writer customized plugins. So my Sharepoint <restricted> tag support plugin, was easy as Pie to install, just grabbed it from this blog, installed it and it runs. Should be easy to do the jp-SyntaxHighlighter too right? Not so much it turns out, first up I hadn’t posted up my code (and that is because the real work was done by somebody else, and I didn’t want anyone to think his work was mine).
No problem of course I had put my source into my TFS server, so I downloaded it, and rebuilt it, and …. It didn’t work correctly in the Live Writer editor. Instead of showing me my code all nicely formatted in the Live Writer editor
It gave me this instead
Not at all what I want. So after about an hour of digging around trying to figure out what was going on, I realised that I had left out a step in my original post. In order to make this work, you need to copy the Scripts directory from the SyntaxHighlighterPlugin project to the location of where the plug-in is dropped for it to work in WLW.
The default place for that would be either C:\Program Files\Windows Live\Writer\Plugins or if you have a 64 bit machine like myself, C:\Program Files (x86)\Windows Live\Writer\Plugins. I updated the post build event in project to copy the relevant files to the correct place upon successful build. And Voila, it works!
XCOPY /Y "$(TargetPath)" "C:\Program Files (x86)\Windows Live\Writer\Plugins\"
XCOPY /Y "$(TargetDir)ja-JP\SyntaxHighlighter.resources.dll" "C:\Program Files (x86)\Windows Live\Writer\Plugins\ja-JP\"
XCOPY /Y "$(TargetDir)Setting.xml" "C:\Program Files (x86)\Windows Live\Writer\Plugins\"
XCOPY /Y /S "$(TargetDir)Scripts" "C:\Program Files (x86)\Windows Live\Writer\Plugins\Scripts\"