Edit Exe Manifest

Posted on  by
Edit Exe Manifest 3,5/5 4013 votes
-->

We recommended that you embed the manifest of your application or library inside the final binary because this guarantees correct runtime behavior in most scenarios. By default, Visual Studio tries to embed the manifest when it builds a project. For more information, see Manifest Generation in Visual Studio. However, if you build your application by using nmake, you have to make some changes to the makefile. This section shows how to change the makefiles so that it automatically embeds the manifest inside the final binary.

As far as I know, mt.exe will work fine on EXE files; both EXE and DLL files are Portable Executable (PE) files, and PE files use the exact same structure for resources such as the manifest. Visual Studio, CFF explorer, and countless other tools (including raw resource APIs) will also work to view and possibly update manifests in general.

  1. The simplest way to create a manifest is: Project Properties - Security - Click 'enable ClickOnce security settings' (it will generate default manifest in your project Properties) - then Click it again in order to uncheck that Checkbox - open your app.maifest and edit it as you wish.
  2. If you are not doing an incremental build you can directly embed the manifest using a command line similar to the following as a post-build step: mt.exe -manifest MyApp.exe.manifest -outputresource:MyApp.exe;1. Mt.exe -manifest MyLibrary.dll.manifest -outputresource:MyLibrary.dll;2. (1 for an EXE, 2 for a DLL.).
  3. Edit the Deployment manifest, which has an extension of.application. On the Update Options tab, uncheck 'This application should check for updates' Tuesday, January 31, 2006 5:54 PM.

Two approaches

There are two ways to embed the manifest inside an application or library.

  • If you are not doing an incremental build you can directly embed the manifest using a command line similar to the following as a post-build step:

    or

    Use 1 for an EXE and 2 for a DLL.

  • If you are doing an incremental build, use the following steps:

    • Link the binary to generate the MyApp.exe.manifest file.

    • Convert the manifest to a resource file.

    • Re-link (incrementally) to embed the manifest resource into the binary.

The following examples show how to change makefiles to incorporate both techniques.

Makefiles (Before)

Consider the nmake script for MyApp.exe, a simple application built from one file:

If this script is run unchanged with Visual Studio, it successfully creates MyApp.exe. It also creates the external manifest file MyApp.exe.manifest, for use by the operating system to load dependent assemblies at runtime.

The nmake script for MyLibrary.dll looks very similar:

Makefiles (After)

To build with embedded manifests you have to make four small changes to the original makefiles. For the MyApp.exe makefile:

For the MyLibrary.dll makefile:

The makefiles now include two files that do the real work, makefile.inc and makefile.targ.inc.

Create makefile.inc and copy the following into it:

Now create makefile.targ.inc and copy the following into it:

See also

-->

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.

For a complete listing of the XML schema, see Manifest File Schema.

Application manifests have the following elements and attributes.

ElementAttributesRequired
assemblyYes
manifestVersionYes
noInheritNo
assemblyIdentityYes
typeYes
nameYes
languageNo
processorArchitectureNo
versionYes
publicKeyTokenNo
compatibilityNo
applicationNo
supportedOSIdNo
maxversiontestedIdNo
dependencyNo
dependentAssemblyNo
fileNo
nameNo
hashalgNo
hashNo
autoElevateNo
disableThemingNo
disableWindowFilteringNo
dpiAwareNo
dpiAwarenessNo
gdiScalingNo
highResolutionScrollingAwareNo
longPathAwareNo
magicFutureSettingNo
printerDriverIsolationNo
ultraHighResolutionScrollingAwareNo

File Location

Application manifests should be included as a resource in the application's EXE file or DLL.

For more information, see Installing Side-by-side Assemblies.

Sccm multiple software update points

File Name Syntax

The name of an application manifest file is the name of the application's executable followed by .manifest.

For example, an application manifest that refers to example.exe or example.dll would use the following file name syntax. You can omit the <resource ID> field if resource ID is 1.

example.exe.<resource ID>.manifest

example.dll.<resource ID>.manifest

Elements

Names of elements and attributes are case-sensitive. The values of elements and attributes are case-insensitive, except for the value of the type attribute.

assembly

A container element. Its first subelement must be a noInherit or assemblyIdentity element. Required.

The assembly element must be in the namespace 'urn:schemas-microsoft-com:asm.v1'. Child elements of the assembly must also be in this namespace, by inheritance or by tagging.

The assembly element has the following attributes.

AttributeDescription
manifestVersionThe manifestVersion attribute must be set to 1.0.
Exe

noInherit

Edit.exe Download

Include this element in an application manifest to set the activation contexts generated from the manifest with the 'no inherit' flag. When this flag is not set in an activation context, and the activation context is active, it is inherited by new threads in the same process, windows, window procedures, and Asynchronous Procedure Calls. Setting this flag prevents the new object from inheriting the active context.

The noInherit element is optional and typically omitted. Most assemblies do not work correctly using a no-inherit activation context because the assembly must be explicitly designed to manage the propagation of their own activation context. The use of the noInherit element requires that any dependent assemblies referenced by the application manifest have a noInherit element in their assembly manifest.

If noInherit is used in a manifest, it must be the first subelement of the assembly element. The assemblyIdentity element should come immediately after the noInherit element. If noInherit is not used, assemblyIdentity must be the first subelement of the assembly element. The noInherit element has no child elements. It is not a valid element in assembly manifests.

assemblyIdentity

As the first subelement of an assembly element, assemblyIdentity describes and uniquely identifies the application owning this application manifest. As the first subelement of a dependentAssembly element, assemblyIdentity describes a side-by-side assembly required by the application. Note that every assembly referenced in the application manifest requires an assemblyIdentity that exactly matches the assemblyIdentity in the referenced assembly's own assembly manifest.

The assemblyIdentity element has the following attributes. It has no subelements.

AttributeDescription
typeSpecifies the application or assembly type. The value must be Win32 and all in lower case. Required.
nameUniquely names the application or assembly. Use the following format for the name: Organization.Division.Name. For example Microsoft.Windows.mysampleApp. Required.
languageIdentifies the language of the application or assembly. Optional. If the application or assembly is language-specific, specify the DHTML language code. In the assemblyIdentity of an application intended for worldwide use (language neutral) omit the language attribute.
In an assemblyIdentity of an assembly intended for worldwide use (language neutral) set the value of language to '*'.
processorArchitectureSpecifies the processor. The valid values are x86 for 32-bit Windows and ia64 for 64-bit Windows. Optional.
versionSpecifies the application or assembly version. Use the four-part version format: mmmmm.nnnnn.ooooo.ppppp. Each of the parts separated by periods can be 0-65535 inclusive. For more information, see Assembly Versions. Required.
publicKeyTokenA 16-character hexadecimal string representing the last 8 bytes of the SHA-1 hash of the public key under which the application or assembly is signed. The public key used to sign the catalog must be 2048 bits or greater. Required for all shared side-by-side assemblies.

compatibility

Contains at least one application. It has no attributes. Optional. Application manifests without a compatibility element default to Windows Vista compatibility on Windows 7.

application

Contains at least one supportedOS element. Starting in Windows 10, version 1903, it can also contain one optional maxversiontested element. It has no attributes. Optional.

supportedOS

The supportedOS element has the following attribute. It has no subelements.

AttributeDescription
IdSet the Id attribute to {e2011457-1546-43c5-a5fe-008deee3d3f0} to run the application using Vista functionality. This can enable an application designed for Windows Vista to run on a later operating system.
Set the Id attribute to {35138b9a-5d96-4fbd-8e2d-a2440225f93a} to run the application using Windows 7 functionality.
Applications that support Windows Vista, Windows 7, and Windows 8 functionality do not require separate manifests. In this case, add the GUIDs for all the Windows operating systems.
For info about the Id attribute behavior in Windows, see the Windows 8 and Windows Server 2012 Compatibility Cookbook.
The following GUIDs correspond with the indicated operating systems:
{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a} -> Windows 10 and Windows Server 2016
{1f676c76-80e1-4239-95bb-83d0f6d0da78} -> Windows 8.1 and Windows Server 2012 R2
{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38} -> Windows 8 and Windows Server 2012
{35138b9a-5d96-4fbd-8e2d-a2440225f93a} -> Windows 7 and Windows Server 2008 R2
{e2011457-1546-43c5-a5fe-008deee3d3f0} -> Windows Vista and Windows Server 2008
You can test this on Windows 7 or Windows 8.x by running Resource Monitor (resmon), going to the CPU tab, right-clicking on the column labels, 'Select Column..', and check 'Operating System Context'. On Windows 8.x, you can also find this column available in the Task Manager (taskmgr). The content of the column shows the highest value found or 'Windows Vista' as the default.

maxversiontested

The maxversiontested element specifies the maximum version of Windows that the application was tested against. This is intended to be used by desktop applications that use XAML Islands and that are not deployed in an MSIX package. This element is supported in Windows 10, version 1903, and later versions.

The maxversiontested element has the following attribute. It has no subelements.

AttributeDescription
IdSet the Id attribute to a 4-part version string that specifies the maximum version of Windows that the application was tested against. For example, '10.0.18226.0'.

dependency

Contains at least one dependentAssembly. It has no attributes. Optional.

dependentAssembly

The first subelement of dependentAssembly must be an assemblyIdentity element that describes a side-by-side assembly required by the application. Every dependentAssembly must be inside exactly one dependency. It has no attributes.

file

Specifies files that are private to the application. Optional.

The file element has the attributes shown in the following table.

AttributeDescription
nameName of the file. For example, Comctl32.dll.
hashalgAlgorithm used to create a hash of the file. This value should be SHA1.
hashA hash of the file referred to by name. A hexadecimal string of length depending on the hash algorithm.

autoElevate

Specifies whether auto elevate is enabled. TRUE indicates that it is enabled. It has no attributes.

disableTheming

Specifies whether giving UI elements a theme is disabled. TRUE indicates disabled. It has no attributes.

Exe Editor

disableWindowFiltering

Specifies whether to disable window filtering. TRUE disables window filtering so you can enumerate immersive windows from the desktop. disableWindowFiltering was added in Windows 8 and has no attributes.

dpiAware

Specifies whether the current process is dots per inch (dpi) aware.

Windows 10, version 1607: The dpiAware element is ignored if the dpiAwareness element is present. You can include both elements in a manifest if you want to specify a different behavior for Windows 10, version 1607 than for an earlier version of the operating system.

The following table describes the behavior that results based upon the presence of the dpiAware element and the text that it contains. The text within the element is not case-sensitive.

State of the dpiAware elementDescription
AbsentThe current process is dpi unaware by default. You can programmatically change this setting by calling the SetProcessDpiAwareness or SetProcessDPIAware function.
Contains 'true'The current process is system dpi aware.
Contains 'false'Windows Vista, Windows 7 and Windows 8: The behavior is the same as when the dpiAware is absent.
Windows 8.1 and Windows 10: The current process is dpi unaware, and you cannot programmatically change this setting by calling the SetProcessDpiAwareness or SetProcessDPIAware function.
Contains 'true/pm'Windows Vista, Windows 7 and Windows 8: The current process is system dpi aware.
Windows 8.1 and Windows 10: The current process is per-monitor dpi aware.
Contains 'per monitor'Windows Vista, Windows 7 and Windows 8: The behavior is the same as when the dpiAware is absent.
Windows 8.1 and Windows 10: The current process is per-monitor dpi aware.
Contains any other stringWindows Vista, Windows 7 and Windows 8: The behavior is the same as when the dpiAware is absent.
Windows 8.1 and Windows 10: The current process is dpi unaware, and you cannot programmatically change this setting by calling the SetProcessDpiAwareness or SetProcessDPIAware function.

For more information about dpi awareness settings, see Comparison of DPI Awareness Levels.

dpiAware has no attributes.

dpiAwareness

Specifies whether the current process is dots per inch (dpi) aware.

The minimum version of the operating system that supports the dpiAwareness element is Windows 10, version 1607. For versions that support the dpiAwareness element, the dpiAwareness overrides the dpiAware element. You can include both elements in a manifest if you want to specify a different behavior for Windows 10, version 1607 than for an earlier version of the operating system.

The dpiAwareness element can contain a single item or a list of comma-separated items. In the latter case, the first (leftmost) item in the list recognized by the operating system is used. In this way, you can specify different behaviors supported in future Windows operating system versions.

The following table describes the behavior that results based upon the presence of the dpiAwareness element and the text that it contains in its leftmost recognized item. The text within the element is not case-sensitive.

dpiAwareness element status:Description
Element is absentThe dpiAware element specifies whether the process is dpi aware.
Contains no recognized itemsThe current process is dpi unaware by default. You can programmatically change this setting by calling the SetProcessDpiAwareness or SetProcessDPIAware function.
First recognized item is 'system'The current process is system dpi aware.
First recognized item is 'permonitor'The current process is per-monitor dpi aware.
First recognized item is 'permonitorv2'The current process uses the per-monitor-v2 dpi awareness context. This item will only be recognized on Windows 10 version 1703 or later.
First recognized item is 'unaware'The current process is dpi unaware. Youcannot programmatically change this setting by calling the SetProcessDpiAwareness or SetProcessDPIAware function.

For more information about dpi awareness settings supported by this element, see DPI_AWARENESS and DPI_AWARENESS_CONTEXT.

dpiAwareness has no attributes.

gdiScaling

Specifies whether GDI scaling is enabled. The minimum version of the operating system that supports the gdiScaling element is Windows 10 version 1703.

The GDI (graphics device interface) framework can apply DPI scaling to primitives and text on a per-monitor basis without updates to the application itself. This can be useful for GDI applications no longer being actively updated.

Non-vector graphics (such as bitmaps, icons, or toolbars) cannot be scaled by this element. In addition, graphics and text appearing within bitmaps dynamically constructed by applications also cannot be scaled by this element.

TRUE indicates that this element is enabled. It has no attributes.

highResolutionScrollingAware

Specifies whether high-resolution-scrolling aware is enabled. TRUE indicates that it is enabled. It has no attributes.

longPathAware

Enables long paths that exceed MAX_PATH in length. This element is supported in Windows 10, version 1607, and later. For more information, see this article.

magicFutureSetting

Specifies whether magic-future setting is enabled. TRUE indicates that it is enabled. It has no attributes.

printerDriverIsolation

Specifies whether printer driver isolation is enabled. TRUE indicates that it is enabled. It has no attributes. Printer driver isolation improves the reliability of the Windows print service by enabling printer drivers to run in processes that are separate from the process in which the print spooler runs. Support for printer driver isolation started in Windows 7 and Windows Server 2008 R2. An app can declare printer driver isolation in its app manifest to isolate itself from the printer driver and improve its reliability. That is, the app won't crash if the printer driver has an error.

ultraHighResolutionScrollingAware

Specifies whether ultra-high-resolution-scrolling aware is enabled. TRUE indicates that it is enabled. It has no attributes.

Example

The following is an example of an application manifest for an application named MySampleApp.exe. The application consumes the SampleAssembly side-by-side assembly.