1

I have created a setup project for a windows application in VS2010 (C#). I have added project primary output in application folder and its shortcut to desktop folder. After installing the setup, the desktop contain shortcut exe file not shows "Run as Administrator" option on mouse right click.

I have seen some post in stack overflow to set the tag in manifest file like this :

 <requestedExecutionLevel level="requireAdministrator" uiAccess="true"/>

But I couldn't find any manifest file in my app. where its location? How to attcah this manifest to setup project?

Please help.

Praveen VR
  • 1,554
  • 2
  • 16
  • 34
  • Changing manifest will force your app to run with elevated permissions. However, it probably wont fix your _Shortcut_ problem. See if this helps - http://wishmesh.com/2010/07/run-as-administrator-missing-for-shortcuts-created-by-visual-studio-setup-project/ – YK1 Jul 25 '13 at 05:28

2 Answers2

4

Add a manifest file to your program.

Click Project -> Add new item -> add Application Manifest File

By default you will see there:

<requestedExecutionLevel level="asInvoker" uiAccess="true" />

Make sure to replace it with:

<requestedExecutionLevel level="requireAdministrator" uiAccess="true"/>

Ofiris
  • 6,047
  • 6
  • 35
  • 58
0

I don't think this is an issue with your installer. The <requestedExecutionLevel level="requireAdministrator" uiAccess="true"/> should just force the application to ask for administrator rights before starting.

Check that the shortcut is targeting the exe correctly, for instance I had 2 shortcuts with different targets (right click on shortcut -> "Shortcut" tab -> Target):

Application 1 Shortcut -> Target "Application1" <- Run as administrator not working

Application 1 Shortcut -> Target "C:\Prorgram Files\App1\Application1.exe". <- Run as administrator working

CristisS
  • 1,103
  • 1
  • 12
  • 31