BenjaminRi / winresource

Create and set windows icons and metadata for executables with a rust build script
MIT License
48 stars 10 forks source link

Add a utility for generating a Windows application manifest #4

Open BenjaminRi opened 1 year ago

BenjaminRi commented 1 year ago

Track issue https://github.com/mxre/winres/issues/44

citreae535 commented 1 year ago

There's already a crate for that: embed-manifest.

Build Script

let manifest = embed_manifest::new_manifest("appname")
    .max_version_tested(embed_manifest::manifest::MaxVersionTested::Windows11)
    .to_string();
winresource::WindowsResource::new()
    .set_manifest(&manifest)
    .compile()

Embedded Manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
    manifestVersion="1.0">
    <assemblyIdentity name="appname" type="win32" version="0.1.0.0"></assemblyIdentity>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity language="*" name="Microsoft.Windows.Common-Controls"
                processorArchitecture="*" publicKeyToken="6595b64144ccf1df" type="win32"
                version="6.0.0.0"></assemblyIdentity>
        </dependentAssembly>
    </dependency>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <maxversiontested Id="10.0.22000.194"></maxversiontested>
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
        </application>
    </compatibility>
    <asmv3:application>
        <asmv3:windowsSettings>
            <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
            <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2</dpiAwareness>
            <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
            <printerDriverIsolation xmlns="http://schemas.microsoft.com/SMI/2011/WindowsSettings">
                true</printerDriverIsolation>
        </asmv3:windowsSettings>
    </asmv3:application>
    <asmv3:trustInfo>
        <asmv3:security>
            <asmv3:requestedPrivileges>
                <asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false"></asmv3:requestedExecutionLevel>
            </asmv3:requestedPrivileges>
        </asmv3:security>
    </asmv3:trustInfo>
</assembly>