How to claims admin permission in wpf for app store

振宁 梁 21 Reputation points

The app needs admin permission to be launched properly. In app.manifest, set requireAdministrator.
Feedback run errors after submission.
The product crashes at launch with error message "The request is not supported."
How should I set permissions?

A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
789 questions
{count} votes

Accepted answer
  1. Hui Liu-MSFT 47,336 Reputation points Microsoft Vendor

    You could try to make the WPF application to Run in Administrator Mode and then published it.

    1. Open the Solution Explorer

    2.Right CLick on the solution--->Add---->New Item---->App.Manifest---->OK
    3. Edit the Manifest file as follows:

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


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

    4.After editing the Manifest file, Goto Solution project(RightCLick)------>properties------->Security

    Turn out the Checkbox of "Enable ClickOnce Security Settings"

    Run the Application, and Take setup, Now the application with Run as Administrator mode is achieved.

    Complete code:

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

    Add the app.manifest file to project, and then ensure the .csproj file contains


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

1 additional answer

Sort by: Most helpful
  1. Blake Pell 0 Reputation points

    For posterity:

    Hui Liu-MSFT provided most of the answer but there's more.

    In order to fix this your Package.appxmanifest file needs to have the correct capabilities in it (you can't set them via the UI). In particular in the Capabilities section you'll need these two:

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

    I was receiveing the same error as you when I only had "runFullTrust". I additionally had to add "allowElevation". That should do the trick for you.

    If you're submitting to the Windows Store you'll want to note to the reviewers in the testing steps why you're requesting elevation.

    Hope this helps (someone).

    0 comments No comments