1

I am having trouble getting the MSI delete my root application folder. All files are correctly deleted on uninstall except the root folder. The MSI is generated by WIX Toolset. Strange things is this happens only with MSIs dished out by our build server. The MSIs generated on my local machine work fine and they do clean up application folder properly. I ran the uninstall in verbose mode but could not find anything alarming.

In past, even my local machine MSIs were not working. But I added KeepEmptyDirectories="true" GenerateGuidsNow="true" in the .wixproj - if that is a useful information. How can I troubleshoot this issue? What are probable red flags that I should be looking for?

murtazat
  • 399
  • 3
  • 12

3 Answers3

0

I would be doing several things:

  1. Get a solid understanding of the component rules and their implications. (What goes wrong when you break them.)

  2. Examining uninstall log files for clues on why Windows Installer choose not to remove the folder.

  3. Test on clean machines. (VM snapshot are the easiest.)

While some people can get lucky, I don't recommend using any sort of dynamic wxs code generation with the exception of a dynamic ProductCode to support major upgrades. This includes everything from dynamic guids on components to component harvesting (aka dynamic file linking). These tend to eventually break the component rules with side effects including what you see here.

That said, I understand the pain of authoring WiX XML by hand and I have an open source project on CodePlex called IsWiX. It consists of project templates (scaffolding) and graphical designers to greatly aid on authoring and maintaining a WiX project. You can then edit the XML by hand on an as needed basis to declare things that IsWiX does not yet handle.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Thanks for your answer. Am not sure what could be wrong with component rules. If rules were wrong, why would the MSIs from my local builds work fine? I checked uninstall log in detail but nothing was alarming. – murtazat May 04 '15 at 21:53
  • Because sometimes you can get away with breaking the rules until you can't. Windows has registry meta data and in certain situations you'll find yourself on the wrong end of Windows Installer trying to make the best out of the information it has. This is one reason for testing on clean snapshotted VMs. – Christopher Painter May 04 '15 at 23:34
  • **The importance of familiarity with the component rules can not be overstatedfor Windows Installer**. Please see [**this answer**](http://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix/1422121#1422121) and see if it helps to understand the core of it. Use one file per component as a basic rule of thumb, with some exceptions explained in the link (there are probably further exceptions). – Stein Åsmul May 05 '15 at 06:30
0

Sounds like there is a lock on the folder itself. Are you running any services that you are stopping as part of the uninstall? Are you running any custom actions that load files from the root folder as part of its operation? Are you setting any custom permissioning on the root directory ACL? Is the root folder an IIS folder? Did you try to reboot after the uninstall to see if the folder is still there?

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Thanks. The root folder is a windows service folder. There is a possibility of locking but then am not sure why my local machine MSI is deleting root folder perfectly. No custom actions. No custom permissions on root folder. I will try reboot now. – murtazat May 04 '15 at 21:55
  • So when you say one MSI works fine and one doesn't, is that in a perfectly controlled test environment? IE exact same machine state (VM snapshot or image restore)? – Christopher Painter May 04 '15 at 23:42
  • msi from build server does not work. msi from my local machine works fine. Both being tested on same machine same environment. – murtazat May 05 '15 at 00:09
  • Why do I have to reboot machine just to see if folder has been deleted? – murtazat May 05 '15 at 06:23
  • I believe the folder may have been scheduled for deletion on reboot. – Stein Åsmul May 05 '15 at 06:28
  • Unless that machine was reimagined "same machine same environment" does not mean same conditions. – Christopher Painter May 05 '15 at 11:25
  • I was assuming he might have used a virtual machine and reverted it. – Stein Åsmul May 05 '15 at 11:45
0

The obvious first step would be to ensure that the service stops properly before being deleted on uninstall. This behavior could be different on different boxes (but it sounds like you test on the same box). See this thread: http://forum.installsite.net/index.php?showtopic=16458

Next, try some diffing on the MSI files themselves and the folders they deliver / install to verify what could be different (if anything).

Try to use dark.exe from the Wix toolkit on the two different MSI files. This will decode them to Wix XML, then use a compare tool such as Beyond Compare, or a similar disk-diff tool, to determine if there are any significant differences between them.

Beyond Compare from http://www.scootersoftware.com/ - is hands down a brilliant tool (no affiliation obviously). I use it all the time, and its usefulness is immediate and a tool all professionals working with files would benefit from every day. Try it. See a screenshot.

Also run a file diff on the installed folders to see if there are any obvious differences. Pay special attention to config files and do a full binary level difference (not just CRC / hashes).

Export your registry hives from HKCU and HKLM (just for your application, not the whole registry) and compare them in before and after states too (4 exports).

As to the differences seen between machines - it sounds like you are using a test virtual, but I just want to add that the presence of visual studio on your box could affect things even if everything else is the same. Other than that the hardware, network and firewall configuration sound like they are the same and that you are testing on a test box.

Have you tried using dependency walker? I have never used it for services, but the profiling option is useful for checking applications in general (how-to).

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Tried exporting MSI to Wix XML - No differences between two .wxs files. Are there any red flags in uninstall log that I should specifically look for? Have not tried dependency walker. – murtazat May 05 '15 at 05:32
  • Sorry - am new to WIX and windows installation. Am not familiar with components and tables etc. Need to fix a bug quickly so have not got time to understand the whole WIX and installation architecture. Let me know if you need to see .wxs, .wixpdb etc. – murtazat May 05 '15 at 05:50
  • Yes, I think we must see the wix source file for this, is it very large? – Stein Åsmul May 05 '15 at 06:49
  • Are you installing the two MSIs on the same test system, or are you testing the one you compile on your own box? – Stein Åsmul May 05 '15 at 07:00
  • You probably need a consultant if you need to fix a bug in a hurry without taking the time to understand Windows Installer development. I might know one. ;) – Christopher Painter May 05 '15 at 11:27