|.Manifest Tracing and Preferring External Manifests|
If you are using internal or external manifests, it can be difficult to diagnose why they do not seem to be working correctly. Sxstrace.exe is a utility built into Windows Vista and later that can diagnose these problems. There is also a registry key that will cause Windows Vista and later to prefer external manifests (just like it is on XP).
Tracing Manifest Usage
The attached zip file contains TraceManifestLoading.cmd which automates the command lines required to create, parse and view the output of sxstrace.exe. This process can tell you if your manifest is being recognized, whether there is an internal manifest and whethere there are any errors in the manifest.
Preferring External Manifests
Windows Vista and Windows 7 have reverse the precedence of internal / external manifest processing. An internal manifest always overrides and external one. There is no overlaying of internal and external manifests, so if an internal manifest is missing the trustinfo section for controlling elevation, you cannot add it with an external manifest. If you use a PE editor to change the internal manifest, you will invalidate any code signing for the EXE.
The setting the registry value HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\PreferExternalManifest (DWORD) to 1 reverses this so that internal manifests are ignored in the presence of an external manifests.
The attached zip file also contains two .REG files for configuring (and deconfiguring) external preference for manifests.
Update: 1/6/2011 - the zip file now also contains our three manifest templates, a reg file for preventing UAC virtualization of .manifest files and touch.ps1 for invalidating the activation context cache (read much more on that here)