Search code examples
c++visual-studio-2017manifest

Enable DPI Awareness setting has no effect (VisualStudio 2017)


I want my program to be DPI aware but I don'T want to set the default awareness programmatically because this is not recommended according to the microsoft docs(https://learn.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process). The Enable DPI Awareness in the project configuration has no effect on the manifest or the programm itself.

What I did: I added a manifest File Added a manifest File I also enabled the DPI Awareness set Enable DPI Awareness to Yes After clear+rebuild it creates a manifest but but all I get is this manifest file without any dpi aware tags.

   <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
    <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
     <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
       <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
       </requestedPrivileges>
      </security>
     </trustInfo>
    </assembly>

I read the docs but I am not able to make it work. A manual edit won't help because the manifest is generated on build: https://learn.microsoft.com/en-us/cpp/build/understanding-manifest-generation-for-c-cpp-programs?view=vs-2019

Hope you can help. I try to answer as fast as possible. If you need more information please let me know


Solution

    • This appears to be a bug in VS2017. If you can upgrade to VS2019 you should upgrade. This solved the problem for me.

    • If you can't upgrade you can right click on the .exe and enable the
      dpi aware flag in the accessibility settings.