Skip to content

Commit ba6d4dd

Browse files
kkm000BillWagner
authored andcommitted
Clarify PackageReference attributes (dotnet#9536)
* Cross-reference the full PackageReference documentation topic from the first sentence. * Update an existing link to the NuGet versioning topic (skip a redirect). * Note that the Version attribute is required, and mention the defaults for the other, optional attributes.
1 parent f1cd0ce commit ba6d4dd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/core/tools/csproj.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,31 @@ The root `<Project>` element of the *.csproj* file has a new attribute called `S
9191
You need to have the `Sdk` attribute set to one of those IDs on the `<Project>` element in order to use the .NET Core tools and build your code.
9292

9393
### PackageReference
94-
A `<PackageReference>` item element specifies a NuGet dependency in the project. The `Include` attribute specifies the package ID.
94+
A `<PackageReference>` item element specifies a [NuGet dependency in the project](/nuget/consume-packages/package-references-in-project-files). The `Include` attribute specifies the package ID.
9595

9696
```xml
9797
<PackageReference Include="<package-id>" Version="" PrivateAssets="" IncludeAssets="" ExcludeAssets="" />
9898
```
9999

100100
#### Version
101-
`Version` specifies the version of the package to restore. The attribute respects the rules of the [NuGet versioning](/nuget/create-packages/dependency-versions#version-ranges) scheme. The default behavior is an exact version match. For example, specifying `Version="1.2.3"` is equivalent to NuGet notation `[1.2.3]` for the exact 1.2.3 version of the package.
101+
The required `Version` attribute specifies the version of the package to restore. The attribute respects the rules of the [NuGet versioning](/nuget/reference/package-versioning#version-ranges-and-wildcards) scheme. The default behavior is an exact version match. For example, specifying `Version="1.2.3"` is equivalent to NuGet notation `[1.2.3]` for the exact 1.2.3 version of the package.
102102

103103
#### IncludeAssets, ExcludeAssets and PrivateAssets
104104
`IncludeAssets` attribute specifies which assets belonging to the package specified by `<PackageReference>` should be
105-
consumed.
105+
consumed. By default, all package assets are included.
106106

107107
`ExcludeAssets` attribute specifies which assets belonging to the package specified by `<PackageReference>` should not
108108
be consumed.
109109

110110
`PrivateAssets` attribute specifies which assets belonging to the package specified by `<PackageReference>` should be
111-
consumed but not flow to the next project.
111+
consumed but not flow to the next project. The `Analyzers`, `Build` and `ContentFiles` assets are private by default
112+
when this attribute is not present.
112113

113114
> [!NOTE]
114115
> `PrivateAssets` is equivalent to the *project.json*/*xproj* `SuppressParent` element.
115116
116-
These attributes can contain one or more of the following items:
117+
These attributes can contain one or more of the following items, separated by the semicolon `;` character if more than
118+
one is listed:
117119

118120
* `Compile` – the contents of the lib folder are available to compile against.
119121
* `Runtime` – the contents of the runtime folder are distributed.

0 commit comments

Comments
 (0)