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.
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.
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:
If the program instead needs administrator privileges to be able to run, the XML script between the trustInfo tags should look like this:
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.
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.
SamLogic Visual Installer
More articles are available from the article index page.
|Article written by: Mika Larramo||Swedish|