You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 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. |
48
48
| 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`|
49
49
| 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`|
50
50
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
+
51
55
#### Audit Sources
52
56
53
57
Restore downloads a server's [`VulnerabilityInfo` resource](../api/vulnerability-info.md) to check against the list of packages each project is using.
Copy file name to clipboardExpand all lines: docs/consume-packages/Central-Package-Management.md
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
---
1
+
---
2
2
title: Central Package Management
3
3
description: Manage your dependencies in a central location and how you can get started with central package management.
4
4
author: jondouglas
@@ -18,7 +18,7 @@ Historically, NuGet package dependencies have been managed in one of two locatio
18
18
-`packages.config` - An XML file used in older project types to maintain the list of packages referenced by the project.
19
19
-`<PackageReference />` - An XML element used in MSBuild projects defines NuGet package dependencies.
20
20
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
22
22
`Directory.Packages.props` file and an MSBuild property.
23
23
24
24
The feature is available across all NuGet integrated tooling, starting with the following versions.
@@ -57,7 +57,7 @@ version.
57
57
</Project>
58
58
```
59
59
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
61
61
`<PackageVersion />` item.
62
62
63
63
```xml
@@ -81,19 +81,24 @@ simplicity, only one `Directory.Packages.props` file is evaluated for a given pr
81
81
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
82
82
be evaluated for it. This allows you extra control at various levels of your repository.
83
83
84
-
Here's an example, consider the following repository structure:
84
+
Consider the following repository structure:
85
85
86
86
```
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
94
99
```
95
100
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.
- 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.
106
111
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.
109
114
110
115
## Get started
111
116
112
-
To fully onboard your repository, consider taking these steps:
117
+
To fully onboard your repository, follow these steps:
113
118
114
119
1. Create a new file at the root of your repository named `Directory.Packages.props` that declares your centrally defined package versions and set
115
120
the MSBuild property `ManagePackageVersionsCentrally` to `true`.
@@ -211,7 +216,7 @@ the feature is disabled.
211
216
212
217
## Disabling Central Package Management
213
218
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
215
220
`ManagePackageVersionsCentrally` to `false`:
216
221
217
222
```xml
@@ -251,8 +256,3 @@ this warning, map your package sources with [package source mapping](https://aka
251
256
```
252
257
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.
253
258
```
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).
Copy file name to clipboardExpand all lines: docs/consume-packages/consuming-packages-authenticated-feeds.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,8 +141,7 @@ However, the credential provider for the .NET SDK is not included by Visual Stud
141
141
142
142
### List of credential providers
143
143
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:
*[Azure Artifacts Credential Provider](https://github.com/microsoft/artifacts-credprovider). This link is just for the command line credential provider.
Copy file name to clipboardExpand all lines: docs/nuget-org/package-readme-on-nuget-org.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,39 @@ Consider including the following items in your readme:
27
27
* Where and how to leave feedback such as link to the project issues, Twitter, bug tracker, or other platform.
28
28
* How to contribute, if applicable.
29
29
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
+
30
63
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.
Copy file name to clipboardExpand all lines: docs/reference/errors-and-warnings/NU1008.md
+30-32Lines changed: 30 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,51 +11,49 @@ f1_keywords:
11
11
12
12
# NuGet Error NU1008
13
13
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.
15
15
16
-
###Issue
16
+
## Issue
17
17
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:
- 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
+
<PackageReferenceInclude="PackageName">
30
+
<Version>5.1.0</Version>
31
+
</PackageReference>
32
+
</ItemGroup>
33
+
```
33
34
34
-
```xml
35
-
<!-- In the project file. -->
36
-
<PackageReferenceInclude="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.
- 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:
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.
59
57
60
58
> [!NOTE]
61
59
> 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.
Copy file name to clipboardExpand all lines: docs/reference/errors-and-warnings/NU1009.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,29 @@ f1_keywords:
11
11
12
12
# NuGet Error NU1009
13
13
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.
15
15
16
-
###Issue
16
+
## Issue
17
17
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).
- 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:
> 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.
Copy file name to clipboardExpand all lines: docs/reference/errors-and-warnings/NU1010.md
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,27 @@ f1_keywords:
11
11
12
12
# NuGet Error NU1010
13
13
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
15
15
16
-
###Issue
16
+
## Issue
17
17
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:
19
19
20
-
### Solution
20
+
```xml
21
+
<ItemGroup>
22
+
<PackageReferenceInclude="PackageName" />
23
+
</ItemGroup>
24
+
```
21
25
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:
- 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