0

I wrote a program run through the administrator thus:

<?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">
                 <!-- <requestedExecutionLevel level="asInvoker" uiAccess="false" /> -->
                 <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
             </requestedPrivileges>
         </security>
</trustInfo>
</asmv1:assembly>
  • But I was getting the following error:

    ClickOnce does not support the request execution level 'requireAdministrator'.

How do you fix it?

haim770
  • 48,394
  • 7
  • 105
  • 133
Tawee Taenkam
  • 45
  • 1
  • 2
  • 6
  • possible duplicate of [Run as administrator: requireAdministrator & ClickOnce + emulating system time](http://stackoverflow.com/questions/5713825/run-as-administrator-requireadministrator-clickonce-emulating-system-time) – Yuval Itzchakov Nov 30 '14 at 08:33

1 Answers1

0

I did also face the same problem.

And I was very keen to avoid of error by importing system, reflection, etc.:

Imports System.IO
Imports System.Net
Imports System.Text.RegularExpressions
Imports System.Text
Imports System
Imports System.Diagnostics
Imports System.Reflection
Imports System.Security
Imports System.Security.Principal
Imports System.Windows.Forms

So I suddenly added Imports System.Security and then the problem was solved :)

I saw that there was no error coming.

But there is one problem: it is still not running it as admin although I successfully implemented

<requestedExecutionLevel level="requireAdministrator"/>

But no worry, as I bypassed this error :P

But if your problem is not solved just import everything that I had written above.

ZygD
  • 22,092
  • 39
  • 79
  • 102
Aditya
  • 9
  • 1
  • 7