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
For any Markdown files generated by AI, always disclose that they were created with the assistance of AI. Add the following frontmatter key/value pair:
6
+
7
+
```markdown
8
+
ai-usage: ai-generated
9
+
```
10
+
11
+
## Terminology
12
+
13
+
Unless otherwise specified, all .NET content refers to modern .NET (not .NET Framework).
14
+
15
+
## Writing Style
16
+
17
+
Follow [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/) with these specifics:
18
+
19
+
### Voice and Tone
20
+
21
+
- Active voice, second person addressing reader directly.
22
+
- Conversational tone with contractions.
23
+
- Present tense for instructions/descriptions.
24
+
- Imperative mood for instructions ("Call the method" not "You should call the method").
25
+
- Use "might" instead of "may" for possibility.
26
+
- Use "can" instead of "may" for permissible actions.
27
+
- Avoid "we"/"our" referring to documentation authors or product teams.
28
+
29
+
### Structure and Format
30
+
31
+
- Sentence case headings (no gerunds in titles).
32
+
- Be concise, break up long sentences.
33
+
- Oxford comma in lists.
34
+
- Use bullets for unordered lists.
35
+
- Number all ordered list items as "1." (not sequential numbering like "1.", "2.", "3.", etc.)
36
+
- Ordered and unordered lists should use complete sentences with proper punctuation, ending with a period if it's more than three words.
37
+
- Avoid "etc." or "and so on" - provide complete lists or use "for example".
38
+
- Use "for example" instead of "e.g.".
39
+
- Use "that is" instead of "i.e.".
40
+
- No consecutive headings without content between them.
41
+
42
+
### Formatting Conventions
43
+
44
+
-**Bold** for UI elements.
45
+
-`Code style` for file names, folders, custom types, non-localizable text.
46
+
- Raw URLs in angle brackets.
47
+
- Use relative links for files in this repo.
48
+
- Remove `https://learn.microsoft.com/en-us` from learn.microsoft.com links.
49
+
50
+
## File Naming
51
+
52
+
New Markdown files: lowercase with hyphens, omit filler words (the, a, etc.).
53
+
54
+
## Special Cases
55
+
56
+
- When you (Copilot) are assigned an issue in GitHub, after you've completed your work and the workflows (status checks) have run, check to make sure there are no build warnings under the OpenPublishing.Build status check. If there are, open the build report (under View Details) and resolve any build warnings you introduced.
Copy file name to clipboardExpand all lines: docs/archive/project-json-and-uwp.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ ms.topic: conceptual
12
12
> [!Important]
13
13
> This content is deprecated. Projects should use the PackageReference formats.
14
14
> Learn how to [migrate your project.json project to PackageReference](./project-json.md#migrate-projectjson-to-packagereference).
15
+
> Visual Studio 2026 automatically migrates project.json at solution load time.
16
+
> [.NET 10 SDK & NuGet.exe 7.0](../release-notes/NuGet-7.0.md) do not support project.json projects.
15
17
16
18
This document describes the package structure that employs features in NuGet 3+ (Visual Studio 2015 and later). The `minClientVersion` property of your `.nuspec` can be used to state that you require the features described here by setting it to 3.1.
Copy file name to clipboardExpand all lines: docs/archive/project-json.md
+25-3Lines changed: 25 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ ms.topic: reference
12
12
> [!Important]
13
13
> This content is deprecated. Projects should use the PackageReference formats.
14
14
> Learn how to [migrate your project.json project to PackageReference](#migrate-projectjson-to-packagereference).
15
+
> Visual Studio 2026 automatically migrates project.json at solution load time.
16
+
> [.NET 10 SDK & NuGet.exe 7.0](../release-notes/NuGet-7.0.md) do not support project.json projects.
15
17
16
18
*NuGet 3.x*
17
19
@@ -40,15 +42,35 @@ The [`project.lock.json`](#projectlockjson) file (described below) is also used
40
42
41
43
## Migrate project.json to PackageReference
42
44
43
-
The migration between project.json and PackageReference is straightforward. The easiest way to do it to use the built-in migrator in the latest Visual Studio 2022, Update 14.
45
+
The migration between project.json and PackageReference is straightforward.
46
+
47
+
### Automatic migration in Visual Studio 2026
48
+
49
+
Visual Studio 2026 and later automatically migrates project.json projects to PackageReference when you open a solution containing project.json projects.
50
+
The migration happens at solution load time:
51
+
52
+
1. Open a solution containing project.json projects in Visual Studio 2026 or later.
53
+
1. Visual Studio automatically detects project.json files and migrates them to PackageReference format.
54
+
1. To check migration status, open the [Output Window](/visualstudio/ide/output-window) and select Show output from "Package Manager".
55
+
You should see messages like "Migrating project.json project..." followed by "Migration Succeeded" for each project.
56
+
Any errors will appear in the Error List.
57
+
1. A backup of the original project file and project.json file is created in a `Backup` folder in the root of the project directory.
58
+
1. The migration converts all package dependencies to PackageReference format in the project file.
59
+
60
+
61
+
### Manual migration in Visual Studio 2022
62
+
63
+
For Visual Studio 2022 and earlier, you can use the built-in migrator:
44
64
45
65
1. Load the project.json project in Visual Studio.
46
66
1. Go to the solution explorer of the project.json project and find the dependencies node.
47
-
1.Click `Migrate project.json to PackageReference...`!
67
+
1.Right-click and select `Migrate project.json to PackageReference...`
48
68
49
69

50
70
51
-
Alternatively, you may use the [dotnet migrate](/dotnet/core/tools/dotnet-migrate), or do the migration manually by taking all of the content from the project.json file and replacing it with the equivalent [PackageReference syntax](../consume-packages/Package-References-in-Project-Files.md).
71
+
### Alternative migration methods
72
+
73
+
Alternatively, you may use the [dotnet migrate](/dotnet/core/tools/dotnet-migrate) command-line tool, or do the migration manually by taking all of the content from the project.json file and replacing it with the equivalent [PackageReference syntax](../consume-packages/Package-References-in-Project-Files.md).
Copy file name to clipboardExpand all lines: docs/concepts/Auditing-Packages.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: How to audit package dependencies for security vulnerabilities and
4
4
author: JonDouglas
5
5
ms.author: jodou
6
6
ms.topic: conceptual
7
-
ms.date: 05/05/2025
7
+
ms.date: 10/01/2025
8
8
---
9
9
10
10
# Auditing package dependencies for security vulnerabilities
@@ -27,6 +27,7 @@ We also have a [blog post](https://devblogs.microsoft.com/nuget/nugetaudit-2-0-e
27
27
|[6.10](../release-notes/NuGet-6.10.md)| N/A | Visual Studio 2022 17.10 |[NuGetAudit](#running-a-security-audit-with-restore) for packages.config|
28
28
|[6.11](../release-notes/NuGet-6.11.md)| .NET 8 SDK (8.0.400) | Visual Studio 2022 17.11 |[NuGetAuditSuppress](#excluding-advisories) for PackageReference |
29
29
|[6.12](../release-notes/NuGet-6.12.md)| .NET 9 SDK (9.0.100) | Visual Studio 2022 17.12 |[Audit sources](#audit-sources). [NuGetAuditSuppress](#excluding-advisories) for packages.config. |
30
+
|[7.0](../release-notes/NuGet-7.0.md)| .NET 10 SDK (10.0.100) | Visual Studio 2026 |[NuGetAuditMode default changes for .NET 10](#configuring-nuget-audit). [`dotnet package update --vulnerable`](#security-vulnerabilities-found-with-updates)|
30
31
31
32
## Running a security audit with `restore`
32
33
@@ -157,7 +158,8 @@ If security vulnerabilities are found and updates are available for the package,
157
158
158
159
- Edit the `.csproj` or other package version location (`Directory.Packages.props`) with a newer version containing a security fix.
159
160
- Use the NuGet package manager user interface in Visual Studio to update the individual package.
160
-
- Run the `dotnet add package` command with the respective package ID to update to the latest version.
161
+
- Run the `dotnet package update --vulnerable` command to update all vulnerable packages in a project to the first version without known vulnerabilities.
162
+
- Run the `dotnet package update` or `dotnet package add` commands with the respective package ID to update to the latest version. Use [`dotnet add package` when using .NET 9 or earlier](/dotnet/core/whats-new/dotnet-10/sdk#more-consistent-command-order).
Copy file name to clipboardExpand all lines: docs/consume-packages/Package-References-in-Project-Files.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -366,6 +366,14 @@ You can also set this conditional MSBuild property in your project file:
366
366
367
367
If locked mode is `true`, restore will either restore the exact packages as listed in the lock file or fail if you updated the defined package dependencies for the project after lock file was created.
368
368
369
+
#### Lock files and PrunePackageReference
370
+
371
+
[PrunePackageReference](#prunepackagereference) changes the dependencies of a project, by removing unnecessary transitive packages.
372
+
While removing these packages should not have an impact at runtime, it will affect lock files.
373
+
If you enable pruning for an existing project, whenever the lock file gets regenerated, it may lead to fewer packages than before pruning.
374
+
The lock file up to date check that powers locked mode is pruning aware, which means if you enabled pruning on a project, the check will account for packages that are pruned.
375
+
However the next time the lock file is regenerated, it will exclude the pruned packages, so you may see a diff that's larger than usual.
376
+
369
377
### Make lock file part of your source repository
370
378
371
379
If you are building an application, an executable, and the project in question is at the start of the dependency chain, then do check in the lock file to the source code repository so that NuGet can make use of it during restore.
Copy file name to clipboardExpand all lines: docs/consume-packages/Package-Restore.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,7 @@ If the package references in your project file or your *packages.config* file ar
44
44
If you have missing packages or package-related errors after you run Package Restore, such as error icons in Solution Explorer, follow the instructions in [Troubleshooting Package Restore errors](package-restore-troubleshooting.md), or [reinstall or update](../consume-packages/reinstalling-and-updating-packages.md) the packages. In Visual Studio, the Package Manager Console provides several options for reinstalling packages. For more information, see [Use Package-Update](reinstalling-and-updating-packages.md#update-package-command).
45
45
46
46
<aname="restore-using-visual-studio"></a>
47
+
47
48
## Restore packages in Visual Studio
48
49
49
50
In Visual Studio on Windows, you can restore packages automatically or manually. First, configure Package Restore through **Tools** > **Options** > **NuGet Package Manager**.
@@ -52,9 +53,10 @@ In Visual Studio on Windows, you can restore packages automatically or manually.
52
53
53
54
Configure the following Package Restore options at **Tools** > **Options** > **NuGet Package Manager** > **General**.
54
55
55
-

56
+

Select **Allow NuGet to download missing packages** to enable package restore and the **Restore NuGet Packages** command. This selection sets the `packageRestore/enabled` setting to `True` in the [packageRestore section](../reference/nuget-config-file.md#packagerestore-section) of the global *NuGet.Config* file, at *%AppData%\\Roaming\\NuGet* on Windows or *~/.nuget/NuGet/* on Mac or Linux.
@@ -90,17 +92,20 @@ Select **Automatically check for missing packages during build in Visual Studio*
90
92
You must select **Allow NuGet to download missing packages** as well as **Automatically check for missing packages during build in Visual Studio** in **Options** to enable package restore during build.
NuGet has two package management formats, [PackageReference](Package-References-in-Project-Files.md) and [packages.config](../reference/packages-config.md). Select the format you want to use from the dropdown list under **Package Management**. You can also select whether to allow format selection on first package install.
96
99
97
100
> [!Note]
101
+
>
98
102
> - If a project doesn't support both package management formats, NuGet uses the package management format that's compatible with the project, which might not be the default you set in the options. NuGet then won't prompt for selection on first install, even if you selected that option.
99
103
>
100
104
> - If you use Package Manager Console to install the first package in a project, NuGet doesn't prompt for format selection, even if that option is selected in **Options**.
After you enable package restore in **Options**, you can right-click the solution in **Solution Explorer** and select **Restore NuGet Packages** to restore packages anytime.
@@ -112,6 +117,7 @@ For projects that use `<PackageReference>`, you can see the package references i
112
117
If you see the error **This project references NuGet package(s) that are missing on this computer**, or **One or more NuGet packages need to be restored but couldn't be because consent has not been granted**, make sure you enabled automatic restore. For older projects, see [Migrate to automatic package restore](#migrate-to-automatic-package-restore-visual-studio). Also see [Troubleshooting package restore errors](Package-restore-troubleshooting.md).
You can use [msbuild -t:restore](../reference/msbuild-targets.md#restore-target) to restore packages in NuGet 4.x+ and MSBuild 15.1+, which are included with Visual Studio 2017 and higher.
@@ -144,6 +152,7 @@ To use MSBuild restore:
144
152
145
153
<aname="restore-using-azure-pipelines"></a>
146
154
<aname="restore-using-azure-devops-server"></a>
155
+
147
156
## Restore with Azure Pipelines or Azure DevOps Server
148
157
149
158
When you create a build definition in Azure Pipelines, you can include the [NuGet CLI restore](/azure/devops/pipelines/tasks/package/nuget#restore-nuget-packages) or [dotnet CLI restore](/azure/devops/pipelines/tasks/build/dotnet-core-cli) task in the definition before any build tasks. Some build templates include the restore task by default.
@@ -192,6 +201,7 @@ To avoid using packages in the HTTP cache:
192
201
- For `nuget restore`, use the `-NoHttpCache` option, or for `dotnet restore`, use the `--no-http-cache` option. These options don't affect restore operations through the Visual Studio Package Manager or Console.
Earlier versions of NuGet supported an MSBuild-integrated package restore. Projects that use the deprecated MSBuild-integrated package restore should migrate to automatic package restore.
0 commit comments