Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Make 64bits Qt app run as admin on windows



  • I try following manifest

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

    Run mt

    QMAKE_POST_LINK += mt -nologo -manifest $$PWD/some_app.manifest -outputresource:$$OUT_PWD/release/$$TARGET".exe" $$escape_expand(\n\t)

    but I got following error

    Activation context generation failed for "C:\Users\yyyy\programs\Qt\build-eyedius-client-Desktop_Qt_5_9_4_MSVC2017_64bit-Release\release\some_app.exe".Error in manifest or policy file "C:\Users\yyyy\programs\Qt\build-eyedius-client-Desktop_Qt_5_9_4_MSVC2017_64bit-Release\release\some_app.exe" on line 2. The required attribute name is missing from element assemblyIdentity.
    

    Have tried ia64, but did not work either. How could I create a correct manifest for this?Thanks



  • @tham said in Make 64bits Qt app run as admin on windows:

    assemblyIdentity version="2.0.2.0" processorArchitecture

    Solved, check this page and write the necessary manifest

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <assemblyIdentity version="34789" name="some app." type="win32"/>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
          </requestedPrivileges>
        </security>
      </trustInfo>  
    </assembly>
    

Log in to reply