C# requestedExecutionLevel with uiAccess="false" doesn't work properly

33 views Asked by At

I'm creating a C# app that needs to run with admin rights - so I've added an app.manifest and made sure I have this line:

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

It seems to work OK when I build the app and run the .exe from its folder, but when I try to debug it from Visual Studio I see this message:

Error message

This is strange as I have set uiAccess="false", but it still seems to think it's true? I'm running VS with admin rights (confirmed by an 'admin' message in the top right).

I see this problem in my main app, and also when I create a new console app, making no changes except adding the app.manifest and setting requestedExecutionLevel as above.

Is there any reason it would think uiAccess is true when I've set it to false?

This was with .NET 8 in VS 2022 pro.

0

There are 0 answers