dotnet / dotnet/msbuild

Understanding CopyLocal, ReferenceOutputAssembly, & Private Properties

Open
#7,986 0 comments 8 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

On ProjectReferences and PackageReferences.

We gotta start unifying this between MSBuild, the SDK, and NuGet.

## Lingering Questions
- What does CopyLocal default to?
- What's the logic behind `Private=true` meaning "copy my stuff over"
- `Private` (MSBuild) flows through items, does that change the behavior in RAR? Or only the "output" behavior?
- Projects need to be able to tell things that reference it: Don't copy this item
- What controls this?

CopyLocal & Private are equivalent but exist in different systems.
CopyLocal (NuGet) <==> Private (MSBuild)

### Private (MSBuild)
Private (MSBuild): Controls copying the output. Doesn't affect referencing.
- Flows to references, flows to RAR.
- Same as `ExcludeAssets=runtime`
**False**: "Don't copy _anything_ to the output directory"
**True** (default): Let stuff copy

`Private` flows to new `Reference` items, and flows to `ResolveAssemblyReferences`.
Same as `ExcludeAssets=runtime`

### CopyLocal (NuGet)
_"Do I take the thing and put it in the output folder?"_
**True**: Let stuff copy
**False**: Don't copy anything to outdir.

### ReferenceOutputAssembly (MSBuild)
True: Pass references to the compiler. Include that in output.
Ultimately decides if the dll gets copied, even when `Private=true`
False: Don't pass reference to compiler, don't include in output.
Does this override `Private=true`?

[LEGACY] `ReferenceOutputAssembly` is equivalent to excludeassets=all. Its referenced, but nothing happens.

### ExcludeAssets (NuGet)
_"Do I reference compile, do I copy runtime?_
This needs a better quote, not sure I captured this.
`all`: Don't reference and don't copy it out.

### PrivateAssets (NuGet)
_"What flows through me to my references?"_

The goal here is probably to create `ExcludeAssets`/`PrivateAssets` equivalents in MSBuild.

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.