我正在尝试更改.NET Core中文件的权限。
然而,似乎 的FileInfo 没有 SetAccessControl
了。
// Create a new FileInfo object.
FileInfo fInfo = new FileInfo(FileName);
// Get a FileSecurity object that represents the
// current security settings.
FileSecurity fSecurity = fInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
fSecurity.AddAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));
// Set the new access settings.
fInfo.SetAccessControl(fSecurity);
目标只是将执行权添加到文件的当前所有者(不是Windows或Unix特定功能)。
有关如何在.NET Core上执行此操作的任何线索?