A solution and workaround to the change in manifest preference behaviour in Windows 2003 SP1 and Windows Vista

Problem

Since upgrading to Windows 2003 SP1 or Windows Vista, applications that depend on the components in external manifest files, stop working. For example SxS Registration Free COM.

Reason

Windows 2003 Server and later Operating Systems including Windows Vista, have a change in the manifest reading behaviour. Previously, in Windows XP the external manifest took priority over any embedded manifest. Therefore if there was an embedded manifest, the external manifest was used in preference. In Windows Server 2003 and later, this behaviour is in fact the opposite, the embedded manifest is now used in preference to an external manifest.  

Verification Method

After collecting a Process Monitor log, you normally expect you manifest file to be read. If you cannot find this entry in the log then you may be experiencing this problem. (e.g. ApplictionName.exe.manifest)

Possible Solution 

The recommendation is that you embed your external manifest into the exe to stop the issue occurring.

a)            Use a post-build step in your project to automate the embedding in Visual Studio. For further information see: http://blogs.msdn.com/chrisforster/pages/embedding-a-manifest-file-using-visual-studio.aspx

 

b)            Alternatively use the tool named “mt.exe”. (This should be provided free with either Visual Studio, or the Windows SDK.) Therefore please install one of these, then open a command window. Please navigate to the directory containing the “mt” tool. The following is a example of the command that may be used:

“Mt.exe –manifest C:\ApplicationName.exe.manifest –outputresource: C:\ApplicationName.exe;1”

(Please note that the exe file will be altered in this process; therefore please consider making a backup of this)

Possible Workaround

It there is a good reason for not embedding your manifest file there is a workaround instead. However it should be noted  that this would require a registry change, and also reversing the behaviour system wide.

The registry change, which reverses the behaviour to give preference to the external manifest file is as follows:

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Modify the registry at your own risk.

1. Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide
2. On the Edit menu, point to New, and then click DWORD Value.
3. Type PreferExternalManifest, and then press ENTER. 
4. Right-click PreferExternalManifest, and then click Modify.
5. In the Edit DWORD Value dialog box, click Decimal under Base.
6. In the Value data box, type 1, and then click OK.
7. On the File menu, click Exit to close Registry Editor.

Please note for Windows 2003 SP1 you will require Hotfix for Microsoft KB912949