Tuesday 21 February 2017

c# - How do I force my .NET application to run as administrator?




Once my program is installed on a client machine, how do I force my program to run as an administrator on Windows 7?


Answer



You'll want to modify the manifest that gets embedded in the program. This works on Visual Studio 2008 and higher: Project + Add New Item, select "Application Manifest File". Change the element to:



 


The user gets the UAC prompt when they start the program. Use wisely; their patience can wear out quickly.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...