Date: 02-16-2022
Return to Index
created by gbSnippets
'Articles:
http://blogs.msdn.com/b/patricka/archive/2009/12/09/answers-to-several-application-manifest-mysteries-and-questions.aspx
http://www.samlogic.net/articles/manifest.htm
'An application manifest is an XML file that describes and identifies the
'shared and private side-by-side assemblies that an application should
'bind to at run time. These should be the same assembly versions that were
'used to test the application. Application manifests may also describe
'metadata for files that are private to the application.
1. If admin privileges are required, then display UAC dialog box
2. Which version of DLL to use (typically comctrl32.dll)
3. Which theme to apply
http://www.samlogic.net/articles/manifest.htm
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. '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="1.0.0.0"
processorArchitecture="*"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
'gbs_01112
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm