It is a setting in the app manifest that tells Windows which privileges the program needs: asInvoker (normal rights), highestAvailable or requireAdministrator (triggers the UAC prompt).
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>- asInvoker: runs with the same rights as the user who started it. This is the right default.
- highestAvailable: uses administrator rights if the user has them, otherwise runs normally.
- requireAdministrator: always asks for elevation and will not start without it.
- In Visual Studio, add the file with Add > New Item > Application Manifest File; it is then used when you build the project.
- Request administrator rights only for what really needs them, such as installers. Elevated programs cannot be dragged onto from normal ones and users see a prompt on every launch.
