Tactical directory nukes

Though I’ve commented before about unnecessarily “nuking” whole registry keys, sometimes it’s what’s needed. The same applies to the file system: Sometimes apps create files and directories that weren’t part of the original installation. MSI makes it easy to remove files, including via wildcard. Individual directories can also be removed, but MSI doesn’t have support for wildcard directories or recursive directory trees. It’s easy to delete trees via custom action but tougher to do so while also handling rollback.

Thanks to Rob’s work on wixcontrib, the code to handling directory nuking was available. I took it with some improvements into WixUtilExtension in WiX v3.6 and it’s available with today’s build: 3.6.1321.0.

Use the RemoveFolderEx element as a child of a Component:

<Component …>
<util:RemoveFolderEx On=”uninstall” Property=”MyDirtyDirectory” />
</Component>

There is one annoying restriction: RemoveFolderEx cannot be used directly on a directory defined in your installer. It’s an annoying chicken/egg problem. As adding directories and files to be deleted affects MSI’s file costing, RemoveFolderEx has to do its thing before costing. Unfortunately, MSI doesn’t set up properties for target directories until after costing is complete.

According to a poll both unscientific and informal, the most common use case is that the directory path is already written to a registry value anyway, for use by the installed application. See Rob’s blog post The WiX toolset’s “Remember Property” pattern for an example. As the AppSearch standard action sets the property well before costing begins, RemoveFolderEx works.

Quick implementation note: RemoveFolderEx works by recursing from the specified directory, adding temporary rows to the RemoveFile table for each subdirectory, one for the directory and one for the files in each directory. This is the pattern I described as “semi-custom actions” way back in 2007.

WiX v3.5 escrow build released, redux

A couple of important but low-risk bugs cropped up since the original WiX v3.5 escrow build was released. So, one last escrow build of WiX v3.5 in 2010: v3.5.2430.0. A quirk of publishing the build omitted the changes since the prior build in the RSS feed:

  • RobMen: SFBUG:3139522 – add MakeSfxCA.exe.config to binaries.zip file.
  • BobArnso: SFFeature:3130590 – Update DifxApp DLLs in DifxApp .wixlibs to version shipped in DDK 7600.16385.1.
  • EricStJ: SFBUG:3147256 Votive 2005/2008 corrupts binary files in templates

Download, install, and let us know how if it’s ready to ship!

WiX v3.5 escrow build released

An escrow build is one that’s final until proven otherwise. In this case, we think WiX v3.5 is ready to go. You can help prove otherwise: Download it, try it out, and file bugs if you find problems. As Rob points out, not all bugs are created equal; a bug has to be severe enough to justify resetting escrow–a four-to-six week delay in the final v3.5 release. WiX v3.6 is still in active development, so bugs that don’t get fixed in v3.5 could still get fixed there.

Personally, I hope v3.5.2325.0 is the final release: 2325 is the number of one of the vital RFCs that make the Internet work.

WiX v3.5 release candidate has been released

The WiX Extended Leadership Team and the WiX v3.5 Executive Release Drivers are pleased to announce that WiX v3.5.2229.0 has been declared the WiX v3.5 Release Candidate build. Release candidates are the builds that come after betas and before the final release: All the features–primarily Visual Studio 2010 and IIS 7.0 support–are implemented and the riskiest bugs have been fixed.

Now’s the time to download it, install it, and let us know if WiX v3.5 is ready to ship.

See Rob’s announcement: http://robmensching.com/blog/posts/2010/10/29/Trick-or-treat-WiX-v3.5-Release-Candidate

Get it here: http://wix.sourceforge.net/releases/3.5.2229.0/

Experimental results part II

It’s been four-plus months since Experimental results part I. All reports point to The Experiment being a success so it’s time to make it permanent. Today I checked in a change that defaults to opting-out of the troublesome disk-costing dialog box. It’s still present but by default will not be shown. If you’re using a stock dialog set, there are no changes you need to make. If you’ve built a customized dialog set, remove the WixUICostingPopupOptOut WiX variable definition from your dialog set fragment or you’re likely to get an error message at link time:

The Windows Installer XML variable ‘WixUICostingPopupOptOut’ is declared in more than one location.  Please remove one of the declarations.

You can opt back in to the disk-costing dialog box by providing a value of 0:

<WixVariable Id=”WixUICostingPopupOptOut” Value=”0″ />

Look for this change in next Friday’s builds of WiX v3.5 and v3.6. (Any build more recent than yesterday’s v3.5.2208.0 and v3.6.1008.0 will have it.)