1
我有一個應用程序需要將一些文件複製到C:\ Program Files下的一個目錄。File.Copy UnauthorizedAccessException
在啓用了UAC的Windows 7上,調用File.Copy時會出現UnauthorizedAccessException。
我添加了一個清單應用我的應用程序如下:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
運行應用程序時我現在得到UAC提示,但它仍然導致UnauthorizedAccessException。
想法?