C ++ Builder / Delphi 2010 Application Manifest Template

After googling so much that it makes me dizzy and a bunch of misleading and conflicting information, I was able to compile the following minimal "template" for an application manifest, which is supposed to define the following:

  • version and name of the program
  • that it doesn't require any special admin rights
  • that it is compatible with Windows Vista up to Windows 8.1
  • what does he know about DPI

Is my manifest file sufficient for the above purpose and are there any errors I should be aware of that I should be aware of? I am in particular puzzled by the xmlns namespace versions and the reason why they are different for parts of this manifest?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

    <assemblyIdentity type="win32"
                      name="Manufacturer.Division.ApplicationName"
                      version="1.2.3.4"
                      processorArchitecture="x86"
    />

    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false" />
            </requestedPrivileges>
        </security>
    </trustInfo>

    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>  <!-- The application supports Windows Vista and Windows Server 2008  -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>  <!-- The application supports Windows 7 and Windows Server 2008 R2   -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>  <!-- The application supports Windows 8 and Windows Server 2012      -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>  <!-- The application supports Windows 8.1 and Windows Server 2012 R2 -->
        </application>
    </compatibility>

    <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
    </asmv3:application>

    </assembly>

      

Edit: Here is my final manifest file template based on help here and further research for future googles.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <assemblyIdentity type="win32"
                    processorArchitecture="*"
                    version="1.2.3.4"
                    name="Manufacturer.Division.ApplicationName"
  />

  <description>My Application Description</description>

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

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>

  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>  <!-- Windows Vista and Windows Server 2008  -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>  <!-- Windows 7 and Windows Server 2008 R2   -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>  <!-- Windows 8 and Windows Server 2012      -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>  <!-- Windows 8.1 and Windows Server 2012 R2 -->
    </application>
  </compatibility>

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
    </windowsSettings>
  </application>

</assembly>

      

Edit 2019: For DPI V2 awareness, changes need to be made as described here:

How do I set the dpiAware property in the Windows application manifest to "per monitor" in Visual Studio?

So this part changes:

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
        <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
        <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
        <gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling> <!-- enables GDI DPI scaling (if needed, otherwise leave out) -->
    </windowsSettings>
  </application>

      

+3


source to share


1 answer


The manifest doesn't include ComCtrl v6 if you want to enable Visual Styles :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <!-- your assemblyIdentity element ... -->
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"
      />
    </dependentAssembly>
  </dependency>
  <!-- your trustInfo, compatibility, application elements ... -->
</assembly>

      



You don't need the declaration xmlns:asmv3

on the top-level element assembly

, as it is re-declared on the element application

.

The XML namespaces used are different as they are defined by different APIs. The manifest file is not a single API, it is a set of values ​​to manage multiple APIs in a centralized location.

+5


source







All Articles