Skip to content

Commit c838305

Browse files
authored
Merge main to live #3429
2 parents 3bc4759 + 8ed4caa commit c838305

File tree

19 files changed

+424
-118
lines changed

19 files changed

+424
-118
lines changed

docs/TOC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@
347347
### [Known Issues](release-notes/known-issues.md)
348348

349349
### NuGet 6.x
350+
#### [NuGet 6.14](release-notes/NuGet-6.14.md)
350351
#### [NuGet 6.13](release-notes/NuGet-6.13.md)
351352
#### [NuGet 6.12](release-notes/NuGet-6.12.md)
352353
#### [NuGet 6.11](release-notes/NuGet-6.11.md)

docs/concepts/Auditing-Packages.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: How to audit package dependencies for security vulnerabilities and
44
author: JonDouglas
55
ms.author: jodou
66
ms.topic: conceptual
7-
ms.date: 02/11/2025
7+
ms.date: 05/05/2025
88
---
99

1010
# Auditing package dependencies for security vulnerabilities
@@ -44,10 +44,14 @@ We recommend that audit is configured at a repository level.
4444

4545
| MSBuild Property | Default | Possible values | Notes |
4646
|------------------|---------|-----------------|-------|
47-
| NuGetAuditMode | direct | `direct` and `all` | If you'd like to audit top-level dependencies only, you can set the value to `direct`. NuGetAuditMode is not applicable for packages.config projects. |
47+
| NuGetAuditMode | See 1 below | `direct` and `all` | If you'd like to audit top-level dependencies only, you can set the value to `direct`. NuGetAuditMode is not applicable for packages.config projects. |
4848
| NuGetAuditLevel | low | `low`, `moderate`, `high`, and `critical` | The minimum severity level to report. If you'd like to see `moderate`, `high`, and `critical` advisories (exclude `low`), set the value to `moderate` |
4949
| NuGetAudit | true | `true` and `false` | If you wish to not receive security audit reports, you can opt-out of the experience entirely by setting the value to `false` |
5050

51+
1. `NuGetAuditMode` defaults to `all` when a project targets `net10.0` or higher.
52+
Otherwise `NuGetAuditMode` defaults to `direct`.
53+
When a project multi-targets, if any one target framework selects `all`, then audit will use this value for all target frameworks.
54+
5155
#### Audit Sources
5256

5357
Restore downloads a server's [`VulnerabilityInfo` resource](../api/vulnerability-info.md) to check against the list of packages each project is using.

docs/consume-packages/Central-Package-Management.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
title: Central Package Management
33
description: Manage your dependencies in a central location and how you can get started with central package management.
44
author: jondouglas
@@ -18,7 +18,7 @@ Historically, NuGet package dependencies have been managed in one of two locatio
1818
- `packages.config` - An XML file used in older project types to maintain the list of packages referenced by the project.
1919
- `<PackageReference />` - An XML element used in MSBuild projects defines NuGet package dependencies.
2020

21-
Starting with [NuGet 6.2](..\release-notes\NuGet-6.2.md), you can centrally manage your dependencies in your projects with the addition of a
21+
Starting with [NuGet 6.2](../release-notes/NuGet-6.2.md), you can centrally manage your dependencies in your projects with the addition of a
2222
`Directory.Packages.props` file and an MSBuild property.
2323

2424
The feature is available across all NuGet integrated tooling, starting with the following versions.
@@ -57,7 +57,7 @@ version.
5757
</Project>
5858
```
5959

60-
For each project, you then define a `<PackageReference />` but omit the `Version` attribute since the version will be attained from a corresponding
60+
For each project, you then define a `<PackageReference />` but omit the `Version` attribute since the version will be obtained from a corresponding
6161
`<PackageVersion />` item.
6262

6363
```xml
@@ -81,19 +81,24 @@ simplicity, only one `Directory.Packages.props` file is evaluated for a given pr
8181
What this means is that if you had multiple `Directory.Packages.props` files in your repository, the file that is closest to your project's directory will
8282
be evaluated for it. This allows you extra control at various levels of your repository.
8383

84-
Here's an example, consider the following repository structure:
84+
Consider the following repository structure:
8585

8686
```
87-
Repository
88-
|-- Directory.Packages.props
89-
|-- Solution1
90-
|-- Directory.Packages.props
91-
|-- Project1
92-
|-- Solution2
93-
|-- Project2
87+
📂 (root)
88+
├─📄 Directory.Packages.props
89+
|
90+
├─📂Solution1
91+
| ├─ 📄Directory.Packages.props
92+
| |
93+
| └─ 📂 Project1
94+
| └─📄Project1.csproj
95+
|
96+
└─ 📂 Solution2
97+
└─ 📂 Project2
98+
└─ 📄 Project2.csproj
9499
```
95100

96-
- Project1 will evaluate the `Directory.Packages.props` file in the `Repository\Solution1\` directory and it must manually import the next one if so desired.
101+
- `Project1.csproj` will load the `Directory.Packages.props` file in the `Repository\Solution1\` directory first and it must manually import any parent ones if desired.
97102
```xml
98103
<Project>
99104
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Packages.props, $(MSBuildThisFileDirectory)..))" />
@@ -102,14 +107,14 @@ Repository
102107
</ItemGroup>
103108
</Project>
104109
```
105-
- Project2 will evaluate the `Directory.Packages.props` file in the `Repository\` directory.
110+
- `Project2.csproj` will evaluate the `Directory.Packages.props` file in the root directory.
106111

107-
**Note:** MSBuild will not automatically import each `Directory.Packages.props` for you, only the first one closest to the project. If you have multiple
108-
`Directory.Packages.props`, you must import the parent one manually while the root `Directory.Packages.props` would not.
112+
**Note:** MSBuild will not automatically import each `Directory.Packages.props` for you, only the first one found in the project directory or any parent directory. If you have multiple
113+
`Directory.Packages.props` files, you must import any files in parent directories manually.
109114

110115
## Get started
111116

112-
To fully onboard your repository, consider taking these steps:
117+
To fully onboard your repository, follow these steps:
113118

114119
1. Create a new file at the root of your repository named `Directory.Packages.props` that declares your centrally defined package versions and set
115120
the MSBuild property `ManagePackageVersionsCentrally` to `true`.
@@ -211,7 +216,7 @@ the feature is disabled.
211216

212217
## Disabling Central Package Management
213218

214-
If you'd like to disable central package management for any a particular project, you can disable it by setting the MSBuild property
219+
If you would like to disable central package management for a particular project, you can disable it by setting the MSBuild property
215220
`ManagePackageVersionsCentrally` to `false`:
216221

217222
```xml
@@ -251,8 +256,3 @@ this warning, map your package sources with [package source mapping](https://aka
251256
```
252257
There are 3 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source.
253258
```
254-
255-
256-
257-
> [!Note]
258-
> Central package management is in active development. We appreciate you trying it out and providing any feedback you may have at [NuGet/Home](https://github.com/nuget/home/issues).

docs/consume-packages/consuming-packages-authenticated-feeds.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ However, the credential provider for the .NET SDK is not included by Visual Stud
141141

142142
### List of credential providers
143143

144-
There is a [feature request to make credential providers installable via .NET tools](https://github.com/NuGet/Home/issues/12567), and this will likely make it easier to discover other credential providers.
145-
Until this is implemented, here is a list of credential providers we are aware of:
144+
Here is a list of credential providers we are aware of:
146145

147146
* [AWS CodeArtifact NuGet Credential Provider](https://docs.aws.amazon.com/codeartifact/latest/ug/nuget-cli.html#nuget-configure-cli)
148147
* [Azure Artifacts Credential Provider](https://github.com/microsoft/artifacts-credprovider). This link is just for the command line credential provider.

docs/nuget-org/package-readme-on-nuget-org.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,39 @@ Consider including the following items in your readme:
2727
* Where and how to leave feedback such as link to the project issues, Twitter, bug tracker, or other platform.
2828
* How to contribute, if applicable.
2929

30+
For example, you can start with this package README template:
31+
32+
```text
33+
# Package readme title, e.g., display name or title of the package (optional)
34+
35+
Start with a clear and concise description: A brief overview of what your package is and does, also what problem it solves.
36+
37+
## Getting started
38+
39+
Explain how to use your package, provide clear and concise getting started instructions, including any necessary steps.
40+
41+
### Prerequisites
42+
43+
What are specific minimum requirements to use your packages? Consider excluding this section if your package works without any additional setup beyond simple package installation.
44+
45+
## Usage
46+
47+
Examples about how to use your package by providing code snippets/example images, or samples links on GitHub if applicable.
48+
49+
- Provide sample code using code snippets
50+
- Include screenshots, diagrams, or other visual help users better understand how to use your package
51+
52+
## Additional documentation
53+
54+
Provide links to more resources: List links such as detailed documentation, tutorial videos, blog posts, or any other relevant documentation to help users get the most out of your package.
55+
56+
## Feedback
57+
58+
Where and how users can leave feedback?
59+
60+
- Links to a GitHub repository where could open issues, Twitter, a Discord channel, bug tracker, or other platforms where a package consumer can connect with the package author.
61+
```
62+
3063
Keep in mind, high quality readmes can come in a wide variety of formats, shapes, and sizes! If you already have a package available on NuGet.org, chances are that you already have a `readme.md` or other documentation file in your repository that would be a great addition to your NuGet.org details page.
3164

3265
> [!Note]

docs/reference/errors-and-warnings/NU1008.md

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,49 @@ f1_keywords:
1111

1212
# NuGet Error NU1008
1313

14-
> Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: PackageId.
14+
> The following PackageReference items cannot define a value for Version: PackageName. Projects using Central Package Management must define a Version value on a PackageVersion item.
1515
16-
### Issue
16+
## Issue
1717

18-
When using central package management, versions must be defined on the PackageVersion item.
19-
20-
In your project file, you may see:
18+
A project is configured to use NuGet [Central Package Management](../../consume-packages/Central-Package-Management.md) and a `<PackageReference />` item is defined which specifies a value for the `Version` attribute:
2119

2220
```xml
23-
<!-- In the project file. -->
24-
<PackageReference Include="PackageId" Version="5.1.0" />
21+
<ItemGroup>
22+
<PackageReference Include="PackageName" Version="5.1.0" />
23+
</ItemGroup>
2524
```
2625

27-
### Solution
28-
29-
- Remove the version from the PackageId PackageReference.
30-
- You may need to add or update the PackageVersion item for PackageId in Directory.Packages.props
31-
32-
Example:
26+
Alternatively, a `<PackageReference />` item is defined with a child `<Version />` element that has a value specified:
27+
```xml
28+
<ItemGroup>
29+
<PackageReference Include="PackageName">
30+
<Version>5.1.0</Version>
31+
</PackageReference>
32+
</ItemGroup>
33+
```
3334

34-
```xml
35-
<!-- In the project file. -->
36-
<PackageReference Include="PackageId" />
37-
```
35+
Projects configured to use [Central Package Management](../../consume-packages/Central-Package-Management.md) should not define a version on `<PackageReference />` items.
36+
The version should be defined in on a corresponding `<PackageVersion />` item with the same identifier in [Directory.Packages.props](../../consume-packages/Central-Package-Management.md#enabling-central-package-management) file instead.
3837

39-
```xml
40-
<!-- In the Directory.Packages.props -->
41-
<PackageVersion Include="PackageId" Version="5.1.0" />
42-
```
38+
## Solution
4339

44-
- Alternatively, you may override an individual package version by using the `VersionOverride` property on a `<PackageReference />` item.
45-
This overrides any `<PackageVersion />` defined centrally.
40+
- Remove the `Version` attribute or child `<Version />` element from the `<PackageReference />` item:
4641

47-
Example:
42+
```xml
43+
<ItemGroup>
44+
<PackageReference Include="PackageName" />
45+
</ItemGroup>
46+
```
4847

49-
```xml
50-
<!-- In the project file. -->
51-
<PackageReference Include="PackageId" VersionOverride="3.0.0" />
52-
```
48+
- Define a `<PackageVersion />` item that specifies the version in the [Directory.Packages.props](../../consume-packages/Central-Package-Management.md#enabling-central-package-management) file with the same identifier as the `<PackageReference />` item:
5349

54-
```xml
55-
<!-- In the Directory.Packages.props -->
56-
<PackageVersion Include="PackageId" Version="5.1.0" />
57-
```
50+
```xml
51+
<ItemGroup>
52+
<PackageVersion Include="PackageName" Version="5.0.1" />
53+
</ItemGroup>
54+
```
5855

56+
Alternatively, Central Package Management allows overriding centrally defined package versions. See [Overriding Package Versions](../../consume-packages/Central-Package-Management.md#overriding-package-versions) for more information.
5957

6058
> [!NOTE]
6159
> Note that metadata such as [IncludeAssets, PrivateAssets etc.](../../consume-packages/Package-References-in-Project-Files.md#controlling-dependency-assets) should remain on the PackageReference item.

docs/reference/errors-and-warnings/NU1009.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,29 @@ f1_keywords:
1111

1212
# NuGet Error NU1009
1313

14-
> The packages PackageId are implicitly referenced. You do not typically need to reference them from your project or in your central package versions management file. For more information, see https://aka.ms/sdkimplicitrefs
14+
> The following PackageReference items are implicitly defined and cannot define a PackageVersion item: PackageName. Projects using Central Package Management require that implicit package versions be specified by the PackageReference item.
1515
16-
### Issue
16+
## Issue
1717

18-
Implicitly defined packages should not be managed centrally.
18+
A project is configured to use NuGet [Central Package Management](../../consume-packages/Central-Package-Management.md) and a `<PackageVersion />` item is defined in the [Directory.Packages.props](../../consume-packages/Central-Package-Management.md#enabling-central-package-management) file for a package that is [implicitly defined](https://aka.ms/sdkimplicitrefs).
19+
Implicitly defined packages are generally declared by an SDK to include packages on your behalf.
20+
For these packages, the owner of the SDK controls the version being used and a user should not define a version with [Central Package Management](../../consume-packages/Central-Package-Management.md).
1921

20-
### Solution
22+
```xml
23+
<ItemGroup>
24+
<PackageReference Include="Microsoft.NETCore.App" Version="9.0.0" IsImplicitlyDefined="true" />
25+
</ItemGroup>
26+
```
2127

22-
Remove the PackageVersion for PackageId
28+
## Solution
29+
30+
- Remove the `PackageVersion` item from the [Directory.Packages.props](../../consume-packages/Central-Package-Management.md#enabling-central-package-management) file that corresponds to the implicitly defined package:
31+
32+
```xml
33+
<ItemGroup>
34+
<PackageVersion Include="Microsoft.NETCore.App" Version="1.0.0" />
35+
</ItemGroup>
36+
```
37+
38+
> [!NOTE]
39+
> Some SDKs allow you to override the implicitly defined package version by setting a specific MSBuild property for that package and the SDK may have documentation on how to do so.

docs/reference/errors-and-warnings/NU1010.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ f1_keywords:
1111

1212
# NuGet Error NU1010
1313

14-
> The PackageReference items PackageId do not have corresponding PackageVersion.
14+
> The following PackageReference items do not define a corresponding PackageVersion item: PackageName. Projects using Central Package Management must declare PackageReference and PackageVersion items with matching names
1515
16-
### Issue
16+
## Issue
1717

18-
The PackageReference PackageId is missing a PackageVersion item.
18+
A project is configured to use NuGet [Central Package Management](../../consume-packages/Central-Package-Management.md) and a `<PackageReference />` item is defined but a corresponding `<PackageVersion />` item with the same name is not defined in the [Directory.Packages.props](../../consume-packages/Central-Package-Management.md#enabling-central-package-management) file:
1919

20-
### Solution
20+
```xml
21+
<ItemGroup>
22+
<PackageReference Include="PackageName" />
23+
</ItemGroup>
24+
```
2125

22-
Add a PackageVersion item for PackageId in the [Directory.Packages.props](../../consume-packages/Central-Package-Management.md).
26+
## Solution
27+
28+
- Define a `<PackageVersion />` item that specifies the version in the [Directory.Packages.props](../../consume-packages/Central-Package-Management.md#enabling-central-package-management) file with the same identifier as the `<PackageReference />` item:
29+
30+
```xml
31+
<ItemGroup>
32+
<PackageVersion Include="PackageName" Version="5.0.1" />
33+
</ItemGroup>
34+
```
35+
- If a `<PackageVersion />` item is properly defined and this error occurs in Visual Studio, check the Error List window for errors related to loading the project or failed [design time builds](https://github.com/dotnet/project-system/blob/main/docs/design-time-builds.md).
36+
If Visual Studio is not able to successfully load the project or a design time build fails, NuGet may log this error because it does not have the required information to restore.
37+
Resolving these underlying issues should fix this error.

0 commit comments

Comments
 (0)