Access to path denied while reading a dll from Program Files which is actually got from a nuget package

前端 未结 2 687
后悔当初
后悔当初 2020-12-22 12:22

Access to path denied error is encountered in Program files (x86), while working with a DLL that is got from nuget package: AODL fo

相关标签:
2条回答
  • 2020-12-22 12:44

    For this application, even for reading the DLLs from the Program Files folder I needed Admin rights so I forced the application to have such rights for execution.

    The below line for the newly created application manifest file is changed and that solved the issue.

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

    The fix is explained well in How do I force my .NET application to run as administrator?

    The reasons are stated well in https://stackoverflow.com/a/50588465/129130

    0 讨论(0)
  • 2020-12-22 12:49

    A bunch of directories - both Programm Files, the root directory of the System Drive, Windows - are heavily protected by NTFS rights. Writing them is usually a plain "no-go". Unless you run around with full administrative rights - wich only Instalers and very rare Adminsitrative tools should even consider - you will not be able to write there.

    However you indicated this happens on a read. Reads being blocked like that is very unusual. You need to check what rights are set on those folders and why. Maybe the installer accidentally copied the rights from your computer, wich only makes sense with your users and groups? Maybe Windows or a third party broke those rights? Not a lot of options I can think of that could apply here.

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