Friday, July 02, 2010

How to remove a corrupted MSI/MST (Error 1721)

I found this out the hard way. I was working on a MSI package creating the 'Transform' (MST file). I added a custom action to register an EXE from a 'locally installed file' in the MST. Silly me I put this action into the removal section instead of the install section. Net result the MSI would install but would not remove because it was trying to run a EXE it had already run during the installation process.

This really caused me a afternoon of headaches as I could not remove the software using the MSI. it kept trying to uninstall using the now corrupted MST file (Not really corrupt just badly coded). Even if I tried to run the unistall from the source it kept using the local copy of the MST with the bad instructions.

The error in eventvwr was - '1721 MSI error'.

The solution turns out to be pretty simple we just needed to remove the local copy of the MST and then uninstall.

The Local MST can be found in two places. If the MSI was installed under the 'USER' context then you'll probably find the MST file under the Users profile. If it was installed under the 'SYSTEM' context then you should be able to find the MST file under the %windir%\installer\{GUIDID} directory.

Simply delete the MST files and then uinstall using the source MSI files.

This method worked for me.. If it works for you please leave a comment.