More on Haack's Troubleshooting Windows MSI Installers

Last night I was looking around to see how ASP.NET MVC was doing and noticed Phil Haack posted that ASP.NET MVC RC2 was available. I was disappointed that the RC2 was basically all setup work. My immediate thought was, "Why didn't they get that stuff right in the first public release?" My second thought was, "Does that mean that previous releases have a poor setup that might be messing up machines?" My third thought was, "Hmm, I installed ASP.NET MVC Preview 4, Preview 5, and RC1... I might have one of those messed up machines."

I went to sleep and woke up this morning to find Phil Haack had a new post titled Troubleshooting Windows MSI Installers. My immediate thought was, "A product waited until the last possible moment to focus on their setup and now there are problems. Color me surprised." My second thought was, "MSIZap? WTF!?!"

[Update: The over dramatic and sarcastic humor here didn't come through, I'm sorry. Phil contacted me in a comment below, via Twitter, and IM all to explain that, in general, the ASP.NET MVC installer has been stable and they've been building it from the beginning. There are a few issues with NGEN and devenv /setup (that we'll talk more about below) but it isn't nearly as bad as my flippant comments above make it out to be.]

Note: I'm picking on Phil a little here because he leads with some poor recommendations on his very popular blog with a generic title of "Troubleshooting Windows MSI Installers". It could really lead people down the wrong rabbit hole and misses an opportunity to actually improve the ecosystem.

[Update: Also, based on our conversation, Phil chose to remove his statements about MSIZap. MSIZap is a dangerous tool, so I've left my comments below for anyone that thinks using MSIZap is a good way to "uninstall". <smile/>]

MSIZap? WTF!?!

My visceral reaction to Phil's post kicked in when I saw him recommending MSIZap at the top of his blog post. Phil has most of the right disclaimers in place by basically suggesting that MSIZap is a last resort tool. Unfortunately, he puts it up front as the first and most effective option to get unblocked.

There are three major issues with MSIZap and the poorly named Windows Installer Cleanup Utility:

  1. MSIZap nukes the registration of the product from the machine but does not actually remove anything the product installed. That means all the stuff you installed is still there and there is now no way to uninstall it (except by hunting it down manually). That left over debris leads us to issue number two.
  2. Your machine is now in an unknown state. The information about what is installed has been surgically eviscerated and when you install the next version (assuming you do that) it will be dealing with debris that it was not designed to encounter (due to issue number one above). Way back when in Office, I'd sometimes get a tester saying that the new build failed to install and they were blocked. After looking at a very bizarre error case for entirely too long, I'd ask exactly what steps they took to get into this state. They'd say, "Oh, I just MSIZapped the previous install." I would nod and say, "Cool, you invalidated your machine. Format and start over." I was nonchalant about it because MSIZap removed our ability to debug the root issue, which brings me to the third point.
  3. You have lost the ability to figure out what went actually wrong. Debugging Windows Installer failures is a matter of analyzing a verbose log file captured from the failed setup operation. As noted above, MSIZap removes the ability to do that. Now, Phil actually provides the information how to do that (msiexec /l*v or the Logging policy). Unfortunately, rather than asking people to send failed logs to his team for diagnosis, Phil proposes people MSIZap when uninstall fails thus moving into a non-debuggable unknown state.

Orca? FTW!?!

Now I love Orca as much as the next setup developer but I would never recommend that users (even if those users are developers) open my MSI package with the editor and start cutting out pieces. That's like suggesting that a user go in with an assembler and edit a compiled binary to work around a crashing bug.

Phil even suggests that "Editing the MSI is not really encouraged since it may cause other problems such as failing to uninstall properly." That or failing to install the product correctly or pretty much anything else. In my mind this is just another way to get into a completely unsupported state. I don't know why Orca is listed as a solution to the problem.

Windows Installer? NO FAIL!

Typically, when this sort of things happens I see everyone pointing at the Windows Installer as the root of the problems. To his credit, Phil does not blame the Windows Installer and there is only one comment on his blog at the time of my writing that does. I make this point because based on the information presented it appear that the root of ASP.NET MVC's failure issues are all in systems developed by Visual Studio: NGEN and devenv /setup.

That means Phil should be able to walk across the hall or across the street and pass along a whole lot of "FAIL" to one or more teams. A follow up blog post today suggests that Phil has already started doing that which is fantastic. My hope is that he will go further and help Visual Studio fix two pieces of the deployment world that I've also found (in my experience with the WiX toolset) to be fragile. The devenv /setup is of a particularly poor design.

What would I have done differently?

Phil's heart is clearly in the right place. He wants all developers to be able to experience the glory that is ASP.NET MVC and doesn't want its installation to deter from that experience. I can get behind that desire so here's what I would recommend doing differently:

  1. Ensure setup is ready from the beginning and that everyone uses it. As Phil is discovering, there are lots of different machine configurations to take into account. Get your setup testing started as soon as you have a build to hand out. I know a lot of developers like to have a "batch file" setup that has all kinds of special ways to get things installed on their machine. They do this to be "faster" or just to "avoid setup". That approach ends up being detrimental to the product because you are now maintaining two ways to install and the one that gets used the most (by the developers and testers for day to day stuff) isn't the one that gets shipped. Finally, when setup is done at the last minute (like RC2) those design decisions that were made early may come back to bite you.
  2. When you have a problem, make a plea to have anyone with a setup failure to send in log files. ASP.NET MVC is built for technically savvy people so it should be easy to post instructions on how to capture those logs. ASP.NET MVC also seems to have a pretty strong community built around it, so I believe they would have flooded the team with data.
  3. With the data build a solution. I expect that a new MSI could be built to address the problems. Then you send the fix and instructions out to all of those with the problem.  It would probably be something like a recache/reinstall (msiexec /fv, a supported switch) over top the problematic install then uninstall. That way the machine stays in a known state and the setup incrementally improves.
  4. With the data go improve other parts of the platform. ASP.NET MVC isn't alone in their installation woes with NGEN and devenv /setup. By turning their installation problem into an opportunity to learn they can help improve other parts of the system that are shared with many products. Then everybody wins.

 

16 Comments

Comment by Brian Rogers on Friday, March 6, 2009 1:57 PM

Waiting until the last minute is always and issue. Treating setup/install/service as a feature of one's product is seldom thought of. Much teaching to do ;)

Comment by Haacked on Friday, March 6, 2009 2:03 PM

Hi Rob, perhaps I should have added more disclaimers to my post. :) One thing I want to make clear is that we did *NOT* wait until the last second to focus on the installer. We've had installer testing all along the whole process. With every release, we've tested the installer. However, we've also had to change the installer with nearly every release as we find certain assumptions change. For example, with the very first release, we were part of the System.Web.Extensions MSI. Then we decided to split MVC into its own installer, which caused ownership of the installer to change hands to a different developer. More recently, we decided to add in the silent install with server-only options. Finally, we very recently learned that shipping System.Web.Routing and System.Web.Abstractions with MVC would be a problem as they are now part of .NET 3.5 SP1. So we needed to remove those assemblies and add a check to the installer that ensures that SP1 check was on the machine. I wish I had the foresight to see all these changes ahead of time, but I did not anticipate them. Partly because I'm still learning my way around existing release processes at Microsoft, and partly because we're cutting new ground with how we release software with ASP.NET MVC. Again, my point here is we *have* been testing all along AND working with the Visual Studio team/CLR team regarding these issues. I wish we had them all resolved already, but we don't. The troubleshooting guide was just a way to give people more insight into what's going on, at their own risk. I think your feedback is right-on regarding how I ordered MSIZap. It really is the nuclear option and I should maybe put radioactive signs around that paragraph. ;)

Comment by Former MSI sufferer on Friday, March 6, 2009 2:06 PM

Between this blog and Aaron Stebner's, I'm forced to conclude that even Microsoft is unable to create MSI installers that don't fall over in inexplicable, unrecoverable and just plain embarrassing ways. If running an MSI installer spatters your system with files, directories and registry keys with such abandon that you need a tool like MSIZap just to find them all, that only means that MSI is fundamentally flawed. Handy rule of thumb: if the 'softies say '...and it uses a database...' about anything other than an actual database, run screaming. Examples: the registry, Outlook, MSI.

Comment by Rob Mensching on Friday, March 6, 2009 3:22 PM

Phil, thanks for setting me straight on the MSI development inside your org. There is no way to predict the future but I was surprised to see a whole RC dedicated to install. Did your product planner not get the memo about being done early to avoid huge sweeping changes like this? Also, it would be very interesting (at least to me ) if you find the root cause of this setup issue. You guys are enough like the WiX toolset that issues you have, we are likely to have too.

Comment by Rob Mensching on Friday, March 6, 2009 3:25 PM

Former, MSIZap doesn't behave the way you describe that's one of the reasons I don't recommend using it. Also, we don't know the root cause of this issue yet. My expectation (based on the very little data I see so far) is that NGEN is going sideways somewhere which means it has to do with some non-MSI developers code. But, as noted above, I'm very curious to see what is actually the root cause.

Comment by Haacked on Friday, March 6, 2009 4:07 PM

Well as I stated, we didn't originally plan to have an RC 2 except that we learned *after* RC 1 that we needed to take an installation dependency on 3.5 SP1. So the changes we made to the installer had nothing to do with finding issues in the installer and everything to do with a change in requirements. And when we make non-trivial installer changes, we like to have a public release. @Former MSI Sufferer the problem has nothing to do with MSI as Rob pointed out, and I should have made that clear. The few issues in our case are due to problems with devenv /setup.

Comment by Eric on Friday, March 6, 2009 7:43 PM

Rob, Let me say first that I think the work you've done on WiX is great. That said I agree with Former MSI Sufferer: MSI is fundamentally flawed. I've come across far too many situations where it's behavior isn't predictable. For example, I have a very simple install (only copying files and registry keys) for a Windows extension that replaces the built-in AVI Explorer handler. Given MSI, I should be able to uninstall my handler and the original registry values will be back. Problem is that only happens some of the time. Sometimes the new registry keys are kept anyways. As best I can tell, this happens when you uninstall the handler within a few minutes of installing it. What I THINK is happening is the MSI system database is still updating and doesn't think anything's been changed. The reason I think this is that I remember some odd advice for installing Windows SP1 (I think). It said something like "wait 30 minutes before installing an additional service pack or uninstalling SP1." I found that odd advice and looked into it and remember a Windows team member saying it was because MSI was still updated the database. That is ridiculous. The database must be ungodly slow to require 30 minutes to complete installation. MSI is by far the slowest installation technology available. Yes it should be more reliable than any Linux package manager because it makes a backup but what's the point if the database isn't ACID-complete?!

Comment by Former MSI sufferer on Saturday, March 7, 2009 5:23 AM

No, the problem has everything to do with MSI, which is so insanely complicated & overarchitected that even Microsoft is unable to create working installers with it - or, apparently, create tools that can create working installers with it.

Comment by Rob Mensching on Saturday, March 7, 2009 7:59 AM

Eric, I agree that the Windows Installer is complex and I agree there are things in it that should be changed/fixed. However, the story you've told sounds like there is some other failure in the system. To debug you need to get a verbose log file and investigate the root issue. Note, Windows service packs are not installed by the Windows Installer but a private system (that is different depending on the OS). That is not the root cause of the installation problems you are seeing. If you do get a verbose log file of the installation/uninstallation failure, I'd be interested to see it.

Comment by Rob Mensching on Saturday, March 7, 2009 8:02 AM

Former, I agree the Windows Installer is complicated and maybe overarchitected for applications smaller than Office (which is most ). However, everything listed in Phil's post and the follow up suggests the root issue is in the CustomActions that call out to non-Windows Installer code. If you want the systems to get better you need to first tackle the things that are broken. That's what I hope is the ultimate take away in the post (despite my poor introduction to it): get the data then find the solution. Don't blame something just cause you don't like it or don't understand it.

Comment by Former MSI sufferer on Saturday, March 7, 2009 7:41 PM

I suppose my chief complaint about Windows Installer is that Windows already had a perfectly workable system for keeping track of what files were present on the machine, plus useful metadata like when they were created, last modified, etc., etc. It's called NTFS. But with Windows installer we have to keep track of component IDs, which sometimes must be changed when the corresponding files change but other times must *not* be changed. And sometimes they have to be the same across different products, except when they have to be different. We have to specify 8.3 names for each installed file, even though it's been fifteen years since Microsoft shipped an OS that didn't support long names (and even though, given the way 8.3 names work, they *can't* be specified in advance without risking name collisions). And if you want to write a single installer that works natively on both 32- and 64-bit Windows - too bad. Not supported. It is to gag. Two years ago, I walked away from Windows Installer, and switched to Inno Setup. The installers I build with it actually work. On the rare occasions that they fail, they're easy to diagnose. And when things go completely wrong, a manual uninstall is a single rmdir command. There's no MSIZap for InnoSetup, because there's no *need* for one.

Comment by Christopher Painter on Sunday, March 8, 2009 10:57 AM

Sigh. Why is this a suprise? I've read so many .NET books that barely cover setup or they cover it incorrectly ( use VDPROJ and Installer Class! ) I've meet so many Agile / TDD / ALT.NET / MVC / C# MVP's / Development Community leaders and they never know anything about setup. I know of one local Austin area C# MVP / blogger / thought leader who once blogged that he uses VDPROJ ( only problem he noticed was lack of MSBuild support but he'll use it anyways ) and this same blogger is a huge MVC supporter who gets preview builds. He basically blogged that he just performs administrative installs ( he didn't know it was called that ) and XCopy deployments. I know of a Microsoft ASP.NET PM's that blog about how to use TFS to build and deploy to different environments with different configuration files. No mention of setup / MSI / WiX. I recently interviewed a TFS expert coming from an ASP.NET Web Retailer who basically said the same thing. They don't write installs for their Web App / UI components. I said yes to hiring him anyways because as wrong as I think that is, he's not alone in thinking it. So seriously, why is any of this a suprise? Their are members of the setup community that know this stuff down pack but the reality is the vast majority of the development community as a whole does not, has not, and never will have a clue. That right there is the number one reason why I think the notion of 'disrupting the centralized setup cycle' is wrong. Yes, developers are the problems, but in every shop I've worked at in the last 13 years, they have refused to be the solution. PS- I'm sick of hearing of Office as the benchmark for complexity. There are so many things that typical .NET based SOA n-Tier appplications do that Office nor MSI even begins to touch. The applications I write deployment for these days are far more complicated then office.

Comment by Bryan on Tuesday, March 10, 2009 7:58 AM

I think the issues that Former MSI sufferer and Eric come across sound a lot like the same issues that people who don't realize setup development is a development practice. It's easy to forget how hard script-based development was. In this environment, it's all about saving the customer's machine. The nice thing about the rigid installer functionality is that your installation doesn't require that your users reformat their machines to get the product back on. I don't know how many times I had to either dig through heaps of registry keys and directory structures because someone didn't consider whether you had permissions to do X or not. MSI is far from perfect, but it's better than all of the alternatives out there by a large margin. But if you're just copying files then why not simply use XCopy ( or thereabouts )? [[Side note: I find it funny when someone says 'I have a simple install' because it usually isn't. Simple shouldn't be defined as "installing a replacement for the default AVI handler". Simple should be defined as "Placing one file on the user's desktop". The former is actually fairly delicate - after all, you have a lot of user experience to consider!]]

Comment by Rob Mensching on Thursday, March 12, 2009 11:38 AM

Former, now you're talking. Except for your expectation that NTFS alone is sufficient to store all the metadata needed to properly manage installation, I totally agree with your complaints about the Windows Installer. I do wonder how often applications are completely removed by a "rd /s" (no registry? no shortucts?) but that is a great goal to strive for. There are features in the Windows Installer that go beyond what you list but for simpler applications I agree with most of your criticisms. You should have started there.

Comment by Rob Mensching on Thursday, March 12, 2009 11:44 AM

Christopher, I was being sarcasting and overdramatic in my statements of surprsise (in a lame attempt to be amusing). Unfortunately, I was also very wrong. Phil has actually been providing a setup for ASP.NET MVC since the beginning and RC2 is primarily about setup due to the number of late changes. That makes good sense. Also, I use Office as *my* example of a complicated because most people know it and I *actually* worked on it (albeit a while ago). Lots of other things I've worked on have been internal only and I don't feel comfortable writing about them yet.

Comment by Bryan on Friday, March 20, 2009 11:41 PM

I think you're underestimating me. When I say simple, I mean simple. My MSI contains 4 files and writes 13 registry entries. I don't know about you but that's a pretty simple install.

Leave a comment
optional