6

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?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • "Required Solution" -> there's another, imo better, and that is to _not_ write in the app settings file but in a user config file. Place it in ProgramData or so. – stijn Aug 16 '13 at 08:58

1 Answers1

9

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.

George Gkionis
  • 211
  • 5
  • 11
  • when my application fetching some dll form Programfies/Company/My applicationat run time it gives me error as The Just-In-Time debugger was launched without necessary security permission –  Aug 16 '13 at 09:44
  • it was my application dll problem not manifest problem.. and your suggestion works for me. Thanx... –  Aug 16 '13 at 10:06
  • 2
    Correction, the manifest file should not be added to the solution, but to the project. (Right-click project in Solution Explorer and Add new item...) – cederlof Aug 28 '15 at 13:44