question

51913496 avatar image
0 Votes"
51913496 asked 51913496 commented

How to claims admin permission in wpf for app store

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?

dotnet-wpf-xaml
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, @519134. Welcome Microsoft Q&A.
Has your project been published? Which publishing method is used? Is there an error when launching in VisualStudio? Or did it report an error after installation? And what is the system environment of the project? Is it possible to display detailed error message?

0 Votes 0 ·

The project runs without errors in Visual Studio. It has been published to the app store as appxupload file. The product crashes without admin permission which download from the app store. Right-click and run as administrator, it will work fine. How can I make the software automatically prompt for administrator privileges when it runs, instead of running without permission and crashes?


0 Votes 0 ·

1 Answer

HuiLiu-MSFT avatar image
0 Votes"
HuiLiu-MSFT answered 51913496 commented

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" />

(TO)

  <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">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>

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

  <ApplicationManifest>app.manifest</ApplicationManifest>


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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

After I followed this, there was no problem running locally. However, the review error occurred after submitting to the store.

"The product's primary functions are not useable. The product fails to launch and displays an error. The request is not supported. The issue was observed on multiple devices running Windows build 19044.1889"

There is often no problem with local running, and various crashes occur after submitting for review. Could I debug with the packaged files on my local computer?


0 Votes 0 ·