wpfapplication-settingsprism-4

How can i start my application as "Run as Administrator" forcefully?


In my application,I am writing some values in application settings file. As i am working with prism I have some module and one shell project. After installing setup

Case: 1

When i have not set compatibility mode as "Run as Administrator". Running application i am able write application settings for all modules but unable to write for main shell project.

Case: 2

When i have set compatibility mode as "Run as Administrator". Now i am able write settings for all.

Required Solution:

I want to set my application compatibility mode as administrator forcefully but don't know how to do it?


Solution

  • Add an app.manifest to your project. In there, under trustInfo --> security --> requestedPrivileges node, uncomment this line:

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

    Then you're good to go.