What is a Manifest (in Windows)?



A manifest is a XML file that contains settings that informs Windows how to handle a program when it is started. The manifest can be embedded inside the program file (as a resource) or it can be located in a separate external XML file. If the manifest is placed in a separate file, then the file must be located in the same folder as the executable file and it must have same filename as the program file, but with a ".manifest" filename extension added at the end (e.g "MYAPP.EXE.manifest").
 
Manifests can also be used with library files (such as DLL files), but in this article we will focus on manifests that are used with program files (EXE files). Manifests that are used with programs are often referred to as application manifests and manifests that are used with DLL files and other library files are often referred to as assembly manifests.
 
Advertisement
Click here for more information about Visual Installer



XML is used
 
The settings in a manifest are always specified by using the XML language (XML is a shortening for Extensible Markup Language). One common setting that often is included in a manifest is information to Windows Vista and Windows 7 if the application requires administrator privileges or if standard user privileges are enough. If the program requires administrator privileges a User Account Control (UAC) dialog box is shown when the program starts and the user must confirm that the application can be run with elevated privileges. If the application only need standard privileges the program is started without the UAC dialog box.


A manifest can be used to give a program a modern design
 
Manifests are also often used to inform Windows which version of a DLL a program is dependent of. By using manifests same DLL can exists in the computer in different versions and the program chooses which version of the DLL to load. This is sometimes referred to as the side-by-side technology in Windows. DLL's that exists in different versions in the computer are sometimes referred to as side-by-side assemblies.
 
One common use of manifests and the side-by-side technology is to inform Windows which version of the Windows common controls the program need to use. The Windows common controls are used to draw menus, dialog boxes, buttons, etc. in an application and two different styles can be used: a classic visual style and a modern visual style. The "modern visual style" is the modern 3D style that was introduced with Windows XP and that has evolved even more in Windows Vista or Windows 7, with shadows, light effects and metal effects etc. The "modern visual style" is also theme-aware so if the Windows user changes the Windows theme, also the application will be affected. If you want your application to use same visual style and also be Windows theme-aware you can specify it in your manifest. In one of the manifest examples below we will show how this can be done.
 
When more than one version of a DLL with the same filename exists in Windows, all additional (newer) versions are located in a folder with the name WinSxS in the Windows folder. The original (oldest) version of the DLL is normally located in Windows system folder.


Manifest file examples
 
Below we will show some examples of manifest files. The manifest examples assume that you are a little familiar with XML since before because XML is the language that is used to define a manifest.

The example below shows a manifest that informs Windows that the program can be run with standard user privileges in Windows Vista and Windows 7:
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="9.0.0.0"
    processorArchitecture="x86"
    name="VI.EXE"
    type="win32"
/>
<description>SamLogic VI Editor</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
        </requestedPrivileges>
    </security>
</trustInfo>
</assembly>
 
If the program instead needs administrator privileges to be able to run, the XML script between the trustInfo tags should look like this:
 
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
        </requestedPrivileges>
    </security>
</trustInfo>
 
As you can see in the example, the "asInvoker" setting has been replaced with a "requireAdministrator" setting at the "requestedExecutionLevel level=" tag. These settings are ignored in Windows XP and only used by Windows Vista and Windows 7 (and by the latest server version of Windows from Microsoft: Windows Server 2008).

In the next example we will show you how you in a manifest can specify that a specific version of Windows common controls should be used. In this example the program wants to use Windows common controls version 6.0, which will give the program a modern visual look.
 
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="9.0.0.0"
    processorArchitecture="x86"
    name="VIS32X.EXE"
    type="win32"
/>
<description>SamLogic Visual Installer (Main Installer)</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="x86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
        </requestedPrivileges>
    </security>
</trustInfo>
</assembly>
 
 
More information
 
If you want to read more information about manifests you can go to this page at Microsoft:
 
Manifest Files Reference
 
If you want to read more about XML you should read this page about XML at Wikipedia.
  
Do you want to read more articles and tips?
 
If you want to read more articles and tips about Windows and related topics you can follow us on Facebook or Twitter, or subscribe on our newsletter. You can also read our blog.
Visit our Facebook page Follow us on Twitter Visit our video channel on YouTube
     
Related products:
SamLogic Visual Installer

Other articles
More articles are available from the article index page.

 
 
SamLogic
Article written by: Mika Larramo Swedish