Sunny
Sunny

Reputation: 952

Run WinForms application without administrator rights?

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.

Upvotes: 1

Views: 5684

Answers (3)

Jagadeesh Govindaraj
Jagadeesh Govindaraj

Reputation: 8285

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

Upvotes: 2

Micke
Micke

Reputation: 2309

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.

Upvotes: 1

Nissim
Nissim

Reputation: 6553

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

Upvotes: 1

Related Questions