Search code examples
c#uwp.net-6.0msix

Windows Application Packaging Project With Admin Rights Project


I have a project that needs admin rights to run. It uses an HTTP listener that otherwise throws an exception.

In my Project I added this line so it will be started with Admin rights:

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

Now when I start the WAPP I get an error message, which is covered in this link, error info

If I set the authorization back to standard, the project starts without problems. The question now is, how can I start the WAPP with admin rights?

WAPP: WAAP here

Error Message is this:

enter image description here

I have looked at the manifest file of the WAPP, but I have not found an area where I can set these permissions. I also deleted all the build folders as described in the link.


Solution

  • Add these restricted capabilities to the manifest file:

    <rescap:Capability Name="runFullTrust">
    <rescap:Capability Name="allowElevation">