Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure .NET app to run elevated

I'm building .NET 3.5 app that I want to run elevated from the start. Its purpose is to configure and control a service.

I can't find any settings anywhere in Visual Studio 2010 that can be used to configure the app in such a way. You'd think there would be a checkbox somewhere in the project's properties that says "run elevated", but no such setting seems to exist.

like image 659
Steve Avatar asked Dec 27 '22 04:12

Steve


1 Answers

Forcing an application to always run as elevated is controlled by a setting in the requestedExecutionLevel setting in the application's manifest file.

All you need to do is add a new item to your project and choose "Application Manifest". The correct settings will be listed in the file with comments listing was to set. Change the requestedExecutionLevel to requireAdministrator and you'll be set.

like image 169
shf301 Avatar answered Jan 14 '23 17:01

shf301