dotnet / dotnet/msbuild

Build output of OutputType Exe is transitively copied even if ReferenceOutputAssembly False

Open
#6,797 4 comments 2 reactions 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Issue Description
Build output of OutputType Exe is transitively copied even if ReferenceOutputAssembly False.

### Steps to Reproduce
A.csproj
```
Exe
```

B.csproj
```

False

```

C.csproj
```

```

Run `dotnet build C`

### Expected Behavior
There is no `A.exe` in output the dir of B or C

### Actual Behavior
There are `A.{exe,deps.json,runtimeconfig.json,runtimeconfig.dev.json}` in the output dir of B or C

`MSBuildCopyContentTransitively = False` helps to some extent. It removes other files except the exe.

PrivateAssets all, IncludeAssets none, ExcludeAssets all doesn't help.
### Analysis

### Versions & Configurations
.NET 5.0.400
MSBuild 16.11.0

### Attach a binlog

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.