Run WinForms application without administrator rights?

5.5k views Asked by At

I have created a windows forms application does some function. The problem is when I deploy the application:

  1. If i deploy with ClickOnce then everything works fine. After installation the winforms application runs without asking for admin password.
  2. If i deploy with Visual Studio Setup Project and create a MSI setup then after installing it requires administrator password every time it runs.

I want to deploy using Visual Studio Setup Project(MSI) , but don't want the software asking for elevated privileges.

The MSI installation does not ask for a password but the installed program does.

3

There are 3 answers

1
Nissim On

Basically you need to edit (or add, if you don't have one yet) an app.manifest file, then use the requestedExecutionLevel to order what is the execution context required.

Read more about it in MSDN

1
Micke On

You'll need to create and embed an application manifest (UAC) in your application, as described here. If you don't want to do that, ClickOnce might be a solution.

MSDN has some useful information on this topic, specifically:

Impact to the user's computer. With Windows Installer deployment, applications often rely on shared components, with the potential for versioning conflicts; with ClickOnce deployment, each application is self-contained and cannot interfere with other applications.

Security permissions. Windows Installer deployment requires administrative permissions and allows only limited user installation; ClickOnce deployment enables non-administrative users to install and grants only those Code Access Security permissions necessary for the application.

0
Jagadeesh Govindaraj On

you need to work with

UAC elevated permission

. take a look at this Ms Documentation link

Also this project doing some R&D with UAC example

Hope this Helps