linguini linguini - 16 days ago 6
C# Question

"Run as administrator" option doesn't shows up in the context menu in Explorer

I'm using VS2012 WPF Application & Install-shield 2013 LE to generate the installer.

After the installation I noticed that "Run as administrator" option doesn't shows up in the context menu in Explorer of the

desktop icon
.

Some of the user couldn't run the application but they can run the application by getting into the installed dir and right click on the icon, Run as administrator.

I checked in this link :
http://msdn.microsoft.com/en-us/library/ms247046.aspx
then I added the option: "Embed manifest with default settings" and regenerated the installer. But it didn't make any change.

I'm making a test on Win 7 OS 32bit.

How can i enable the option "Run as administrator" when i right click on application icon in the context menu in Explorer?

Same problem like this question: VS 2010 setup shortcut file not shows Run as Administrator option

app.manifest:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.

<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />

Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Windows will automatically select the most compatible environment.-->

<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>

<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>

<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>

</application>
</compatibility>

<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>

</asmv1:assembly>


enter image description here

enter image description here

Edited:

I figured it out that the InstallShield 2013 LE(Limited Edition) is not allowing me to put the target directioy like this :
"C:\ProgramFiles\TestUtility.exe"
. If the target refer to exe, then the 'Run as Administrator' will be enabled automatically.

Original:

enter image description here

It should be like this:

enter image description here

So, InstallShield LE is doesn't allow me to change that.

I have to find another way to generate the installer. Any suggestion please?

Answer

I finally found why the 'Run as Administrator' is not enabled. When an installed icon is not referred to .exe it won't be available.

On top of this InstalShield 2013 LE version doesn't allow to change the "Target Directory" value.

Link: http://community.flexerasoftware.com/showthread.php?206542-Permissions-setting-to-edit-within-directory

It's important to refer the .exe; why? the user can run the application as an Administrator through Windows Explorer Context Menu.

I decided to go with WIX installer.

Please give me your FB.

Comments