We were porting a .Net 4.0 class Library to .Net Core 1.1 and struck with an issue of very limit support for file Security and permissions in .Net core CLR.
We were trying to set the access control permissions to a file as below, and it seems that FileInfo doesn’t have any SetAccessControl or GetAccessControl anymore.
// Get a FileSecurity object that represents the // current security settings. FileSecurity fSecurity = File.GetAccessControl(fileName); // Add the FileSystemAccessRule to the security settings. fSecurity.AddAccessRule(new FileSystemAccessRule(account, rights, controlType)); // Set the new access settings. File.SetAccessControl(fileName, fSecurity);
The goal is just to add execution right to the current owner of a file , any help is highly appreciated.