Setting the correct manifest version

The Windows Vista Controls for .NET 2.0 library makes direct calls in Windows Vista's new common control DLL (comctl32.dll, version 6.0). For backwards compatibility reasons, applications with the default manifest or without a manifest automatically load the old version of the common controls (that is, version 5.0). Some calls will then fail at runtime, because the new Vista DLL entry points do not exist.

Therefore, you must add a custom manifest to your project in order to tell Windows to load the new DLL (this is especially true for the Task Dialog class, which contains many calls which will fail with the wrong common controls library).

Add the manifest file

Add a new text file to your project, with the following name: <project name>.exe.manifest

manifest1.png

A basic manifest that expresses the dependecy on comctl32.dll version 6.0 goes as following:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
				xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

	<dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="*"
                publicKeyToken="6595b64144ccf1df"
                language="*"
        />
        </dependentAssembly>
    </dependency>
  
</asmv1:assembly>


Notice that we specified that we need version 6.0.0.0 and that we accept all languages and all architectures of the library. You could also limit the allowed processArchitecture value writing "x86" or "amd64" instead of the wildcard "*".

Embed the manifest

Embedding the created manifest is easy: open the project's properties window and select the correct manifest file.

manifest2.png

Done

That's it. Your application will now load the new Vista comctrl32 DLL and Task Dialog (and every other feature of the library) will work as expected. :)

Last edited Feb 28, 2008 at 1:28 AM by Lck, version 2

Comments

No comments yet.