C - 将可执行文件移动到其他位置后,将忽略 app.exe.manifest 设置



我正在使用MinGW构建我的Windows应用程序:

windres app.rc -O coff -o app.res
gcc -w -mwindows -o app.exe app.c  app.res

这是我的应用程序.exe.manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.1.0.0"
    processorArchitecture="x86"
    name="controls"
    type="win32"
/>
<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.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"
            />
      </requestedPrivileges>
    </security>
  </trustInfo>
<asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">
      <gdiScaling>true</gdiScaling>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

我这样做是为了启用Windows 10的新GDI缩放。在我将可执行文件移动到其他位置之前,它工作正常。

令人惊讶的是,复制整个目录无济于事,因此系统不需要清单或资源文件。路径似乎在某处被硬编码。

我该如何解决这个问题?

谢谢

原来我的清单很糟糕。它不包括 xmlns:asmv3 参数

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

最新更新