1
votes

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
If you install as a MSI setup, you need admin rights to install, but you should not need admin rights to run the program. Can you clarify that the program automatically prompts for the administrator password, that you don't have an embedded UAC manifest and the exe name doesn't contain either setup or install.sgmoore
I had this problem because the shortcut to the application had the "Run as administrator" option set in its properties.Thorsten Dittmar
@ThorstenDittmar i looked for that, but both the shortcut and exe ask for admin privilege.Sunny
What do you mean? Is the checkbox "Run as administrator" checked in the properties? Then that's the problem. In that case you need to figure out why that's the case. They are not set by default.Thorsten Dittmar
Nope. Both are not checked.Sunny

3 Answers

2
votes

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

1
votes

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
votes

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.