Sometimes you want that your program requires to run with "administrator" privilege. For instance, if your program needs to listen to the TCP port 80.
This means that you would like to have this kind of message to appear at program start to request the user to grant the program elevated privilege.
The solutionIt is possible to specify in Visual Studio to specify that an executable must be run with administrator privileges.
To do that you need to perform the 2 following steps:
- Add to the solution an "app.manifest" file
The app.manifest is added to your solution
- Modify this file to set the correct value to requestedExectionLevel:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Note: When you try to debug such program inside the Visual studio environment, The visual studio shall detect that the administrator privileges are needed and request you to restart Visual studio in administrator mode.