dotnet / dotnet/sdk

WebPublishMethod=Package: Generated .zip does not inherit parent ACLs

Open
#51,805 3 comments 0 reactions 0 assignees View on GitHub
Area-WebSDK untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Issue Description

When building a web project with MSBuild using WebPublishMethod=Package, the produced package .zip file does not inherit parent folder ACLs. Other build outputs in the same directory do inherit permissions correctly.

This appears consistent with similar reports in the past (https://stackoverflow.com/questions/7028170/msbuild-web-deploy-package-zip-file-does-not-inherit-permissions-from-parent-fol). Resetting the file’s ACL to inherit from the parent immediately resolves the issue.

### Steps to Reproduce

1. Ensure the parent output folder has custom ACL set.
`icacls .\`

2. Build the project:
`msbuild ".\project\project.csproj" /p:Configuration=Release /p:Platform="AnyCPU" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="..\builtProjectPackage\builtProject.zip"`

3. Check the ACL of the ZIP file and any other build output file:
```
icacls .\builtProjectPackage\builtProject.deploy.cmd
icacls .\builtProjectPackage\builtProject.zip
```

### Expected Behavior

The package .zip inherits ACLs from its parent folder (consistent with other build outputs).
```
icacls .\
.\ domain\test:(OI)(CI)(RX)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
domain\user:(I)(OI)(CI)(F)

Successfully processed 1 files; Failed processing 0 files
```

```
icacls .\builtProjectPackage\builtProject.deploy.cmd
.\builtProjectPackage\builtProject.deploy.cmd domain\test:(I)(RX)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)
domain\user:(I)(F)

Successfully processed 1 files; Failed processing 0 files
```

```
icacls .\builtProjectPackage\builtProject.zip
.\builtProjectPackage\builtProject.zip domain\test:(I)(RX)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)
domain\user:(I)(F)

Successfully processed 1 files; Failed processing 0 files
```

### Actual Behavior

The package .zip produced by WebPublishMethod=Package does not inherit the parent ACLs.

```
icacls .\
.\ domain\test:(OI)(CI)(RX)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
domain\user:(I)(OI)(CI)(F)

Successfully processed 1 files; Failed processing 0 files
```

```
icacls .\builtProjectPackage\builtProject.deploy.cmd
.\builtProjectPackage\builtProject.deploy.cmd domain\test:(I)(RX)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)
domain\user:(I)(F)

Successfully processed 1 files; Failed processing 0 files
```

```
icacls .\builtProjectPackage\builtProject.zip
.\builtProjectPackage\builtProject.zip NT AUTHORITY\SYSTEM:(F)
BUILTIN\Administrators:(F)
domain\user:(F)

Successfully processed 1 files; Failed processing 0 files
```

### Analysis

_No response_

### Versions & Configurations

```
msbuild -version
MSBuild version 17.14.14+a129329f1 for .NET Framework
17.14.14.31908
```

```
msdeploy | find "Version"
Version 7.1.9419.055
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.