How to give my C# app administrative rights? manifest file

后端 未结 2 940
甜味超标
甜味超标 2020-12-02 01:20

I\'m having some trouble with my C# app that uses win32_networkingadapterconfig. The problem is that I can\'t use the altering functions in win32_networkingadapterconfig whe

相关标签:
2条回答
  • 2020-12-02 02:07

    There's a "trustinfo" dangling in your snippet. Make it look like this:

    <?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="requireAdministrator" uiAccess="false" />
          </requestedPrivileges>
        </security>
      </trustInfo>
    </asmv1:assembly>
    
    0 讨论(0)
  • 2020-12-02 02:14

    There are a number of possible issues which I have listed in the order I suspect is most likely to less likely.

    Possible Problem 1
    What are your UAC settings? As detailed in Create and Embed an Application Manifest (UAC) if you have UAC disabled and you request administrator permissions the

    Application might launch but will fail later

    Possible Problem 2
    There could be something wrong else where in the manifest as the assembly information is required. Posting your whole manifest would help.

    Possible Problem 3
    You have added the applicationRequestMinimum node which is not required for UAC escalation. It may be worth dropping that and trying again.

    0 讨论(0)
提交回复
热议问题