Troubleshooting Windows Presentation Foundation Install Issues

By my reckoning, the most recent Feb 2006 CTP of WinFX represents the eleventh public release for Windows Presentation Foundation. (And I'm going to step out onto a limb and conjecture that we've probably got just three or four CTP-style releases to go before we release WinFX.) Most of these releases have of course come with a variety of associated paraphenalia, including SDKs, developer tool extensions and even dependent applications such as Microsoft Max or Expression Interactive Designer.

Moving from release to release is an inexact science. It doesn't take a mathematical genius to figure out that there are hundreds of combinations of different build histories on machines out there, and inevitably (since the setup process is also beta) there can be bits of cruft left over on machines after one element or another is installed. The comments on the entry I wrote to announce EID are a good reminder for us here that we've not cracked this yet. I can't offer a panacea, unfortunately - it's the price we all pay for being early adopters of a new system-level component that integrates tightly with the rest of the operating system - but I did want to offer some tips to try and mitigate the worst of the pain and help people get their machines clean. (Not that this will be of any comfort, but it's not any easier internally, where there are daily builds from multiple build labs to deal with!)

  1. By far the most important step is to make sure that you've uninstalled all the components of older versions before updating to the latest release. Go into Add / Remove Programs and check for any of the following:
    • Microsoft Windows SDK (or WinFX SDK)
    • Microsoft Visual Studio Code Name "Orcas" CTP for WinFX (known in earlier versions as the Visual Studio Extensions for WinFX)
    • Debugging Tools for Windows (installed by the Windows SDK)
    • Microsoft Command Shell (installed by the Windows SDK)
    • Microsoft FxCop (installed by the Windows SDK)
    • WinFX Runtime Components
    • Microsoft Codename "Avalon" (this stems back from the days before we distributed as part of WinFX)
    • Microsoft Max
    • Microsoft Expression Interactive Designer
    • Microsoft Expression Graphic Designer

It's probably safest to uninstall all of the above just to be sure, making sure you leave the WinFX Runtime Components until last.

  1. Once you've uninstalled everything you can, we have an uninstall tool that helps clear up any other unwanted files. This helps with a few known situations where the uninstaller fails to remove a few shared assemblies successfully.
  2. The first two steps should get you into a position where you can install a fresh new release. If you're still having trouble, we need to get down to the next level of investigation. Perform steps 1 and 2 again to get back to semi-clean. Then it's worth checking the contents of the following directories:
    • %WINDIR%\Microsoft.NET\Windows
    • %WINDIR%\WinFX\v3.0\WPF
    • %PROGRAMFILES%\ReferenceAssemblies\Microsoft\WinFX\v3.0

I've seen occasions before where one or two older files can get left over in these directories that can fool installers such as Expression Interactive Designer, or worse, can prevent newer versions from being installed. In particular, if you see files such as PresentationCore.dll, PresentationFramework.dll or WindowsBase.dll, that should act as a warning sign to you that you've got some left-over cruft. Make sure you don't just randomly delete the content of these directories unless you're sure that the uninstallers have done all they can do - you start to edge into completely unsupported territory at this point, since it's hard to troubleshoot a system in this state.

  1. If your machine has had a chequered history with many older versions of WinFX on your machine, you might want to try running Dan Mohr's Avalon cleanup script, which looks for various system DLLs such as milcore.dll (the Media Integration Layer, a low-level component that renders WPF content to screen) and cleans them and their associated registry entries out.
  2. For Expression Interactive Designer, if all else fails, you can use the undocumented SKIPAVALONVERSIONCHECK=1 parameter at the command line to force EID to install without heed to the version of WPF it detects on the machine. Make sure you've successfully executed an application with the appropriate version of WinFX on your machine prior to using this brute-force approach. For example, Valentin Iliescu has a great 3D Chess game implemented as a XAML Browser Application that can test whether you have a fully working WinFX Runtime Components installation.
  3. When recompiling an application from a previous build, I've found that it's safest to entirely clear out the bin/ and obj/ directories from your project before attempting a rebuild. Sometimes left-over object files from a previous release can cause rogue build breaks.
  4. Make sure you have Windows Media Player 10 installed on your machine if you want to show media elements.
  5. It's important to run the latest available updated display card drivers for your machine. Because of the way WPF uses DirectX (multiple non-fullscreen windows), we've uncovered a number of display driver bugs that can cause crashes or other unintended effects. We try and mitigate this by switching to software rendering for older drivers, but that inherently reduces the performance of all WPF applications. If you can, get current!

That's all the tips I can think of for now. I'll update this entry as appropriate over the next day or two with any corrections or additional suggestions. I'll sound like a faceless corporate automaton if I apologize for any inconvenience caused, but I do mean it! In an ideal world we'd do a better job in the installer of cleaning up old installs, but that would really detract from the purpose of CTP releases, which is to get regular updates out to the developer community without imposing a heavy burden on the developer team. I hope this post at least helps to explain the trade-off, even if it's still not all that pleasant for us in the trenches.