Fixed the UAC problems with my "Vista and Office 2007 Preview Handler Pack"

Being a good coder I’ve taken my laptop on holidays with me, and decided that tonight would be a good time to tackle the UAC issue with my Vista preview handlers.

The latest (and UAC friendly) version is here:

http://tatham.oddie.com.au/files/PreviewHandlerPackSetup.msi

Basically, I needed to force an escalation prompt. This task itself is pretty easy and well documented, however VS2005 (which I’m using to make my MSIs) isn’t exactly a full featured installer package – it barely knows how to copy files.

In the end I found a really useful blog post by Aaron Stebner that explains how to do just that. He solves the problem using a post-build script that fixes the MSI generated by VS2005.

Unfortunately Aaron’s solution didn’t work straight out of the box as the MSI path wasn’t being passed to the script at all. After beating my head against the wall and retyping the post-build event several times I found this little gem:

The VS2005 macro name has a typo in it!