I’m still working on my SmugMug plugin for Windows Live Writer. I’ve ported it from VS 2005 to VS 2008, that was trivial. I’m at the point where I want to debug the plugin while it’s being loaded from Live Writer. Normally, this is pretty straight forward. You use the post-build event to copy the plugin’s files to the Live Writer plugin folder. For my plugin, I used the following build event:
xcopy /D /R /Y “$(TargetDir)s*.dll” “C:\Program Files\Windows Live\Writer\Plugins”
The next step is to go into the Debug settings for the project and set the Start Action to Start external program, setting it to the path to the Live writer executable. On my machine, that would be:
C:\Program Files\Windows Live\Writer\WindowsLiveWriter.exe
With that set, all I need to do is to press F5 and my plugin gets built, copied to the Live Writer plugin folder, then Live Writer gets launched. Sounds good, but when I did a test build to verify the files would get copied, I got the following error message:
“XCOPY /D /Y /R “C:\dev\DotNet\LiveWriter\SmugMug4WindowsLiveWiter\SmugMug4WLW\bin\Debug\s*.dll” “C:\Program Files\Windows Live\Writer\Plugins\”
” exited with code 4. SmugMug4WLWPlugin
Code 4? I had to get Mr Peabody to look that one up for me. DOS 3.2 ring a bell? At any rate, exit code 4 for xcopy is “Initialization error (not enough memory, invalid syntax, path not found)”. That actually was a clue to what the problem was, I was just missing the obvious. I tried pasting that xcopy command into a Take Command shell window and it ran without errors. So the syntax was correct, something was blocking it.
D’oh! I’m doing this under Vista. Joe User can’t just copy files into “program files” space, that’s no longer allowed. Only administrators have write access to “program files” and I’m running VS2008 without elevation. I run my Take Command shell as admin, so of course it can write to the plugins folder.
To get around this, I decided to punch a hole through Vista’s default rights for that folder and give everyone and their dog full access to it. I tried doing it through icacl, but I wasn’t getting the syntax right. So I just opened up explorer, selected the plugins folder, right-clicked and selected “Properties”. I then selected the “Security” tab and then selected Users under “Group or user name”. Next, I clicked the edit button, to bring up the edit dialog for the access rights. I selected “Full Control” and then clicked “Ok” all the way home.
That fixed it. VS2008 was able xcopy my plugin without any errors.