@joebigelow / wix-1 / commits / bf9daf75

Migrate ResetAcls to Core.Native from Core

Rob Mensching committed Mar 16, 2021 at 14:50 UTC bf9daf7547175f7a17b949feaeaa9f3cac388073
2 files changed +3 -11
src/WixToolset.Core/Bind/TransferFilesCommand.cs
+3 -10
@@ -5,7 +5,6 @@ namespace WixToolset.Core.Bind
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 - using System.Security.AccessControl;
8 using WixToolset.Core.Native;
9 using WixToolset.Data;
10 using WixToolset.Extensibility;
@@ -157,19 +156,13 @@ namespace WixToolset.Core.Bind
156 // during the file transfer process.
157 if (0 < destinationFiles.Count && !this.SuppressAclReset)
158 {
160 - var aclReset = new FileSecurity();
161 - aclReset.SetAccessRuleProtection(false, false);
162 -
159 try
160 {
165 - foreach (var file in destinationFiles)
166 - {
167 - new FileInfo(file).SetAccessControl(aclReset);
168 - }
161 + FileSystem.ResetAcls(destinationFiles);
162 }
170 - catch
163 + catch (Exception e)
164 {
172 - this.Messaging.Write(WarningMessages.UnableToResetAcls());
165 + this.Messaging.Write(WarningMessages.UnableToResetAcls(e.Message));
166 }
167 }
168 }
src/WixToolset.Core/WixToolset.Core.csproj
-1
@@ -24,7 +24,6 @@
24 you update these here, be sure to update them there.
25 -->
26 <ItemGroup>
27 - <PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.6.0" />
27 <PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
28 <PackageReference Include="NuGet.Versioning" Version="5.6.0" />
29 </ItemGroup>