How to set up WinUI3 applications to run as administrators

C CB 40 Reputation points

I'm begging to write WinUI3 application. Administrator privileges are required for certain functions. In the Win-form program, simply configure the following in the app. manifest

<requestedExecutionLevel level="requestAdministrator" uiAccess="false"/>

However, how to configure in WinUI3, including both packaged and unpackaged.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
737 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,489 questions
{count} votes

Accepted answer
  1. Castorix31 82,406 Reputation points

    On my 1.4.2 version on Windows 10, it is the same way for unpackaged app (with requireAdministrator , not requestAdministrator...)

    For packaged, it seems to work with

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

    in Package.appxmanifest (I checked with Task Manager or Process Explorer) but debugging does not work.

0 additional answers

Sort by: Most helpful