Skip to content

Commit 856dfae

Browse files
authored
Merge pull request #3487 from NuGet/main
Docs to Live, Mid October
2 parents efa87e1 + e54b100 commit 856dfae

File tree

45 files changed

+486
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+486
-158
lines changed

.github/copilot-instructions.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# .NET Documentation Guidelines
2+
3+
## Disclosure
4+
5+
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.

docs/TOC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
### [nuget.exe CLI](consume-packages/install-use-packages-nuget-cli.md)
1818
### [Package Manager Console (PowerShell)](consume-packages/install-use-packages-powershell.md)
1919
## Configure NuGet
20+
### [Visual Studio options](consume-packages/nuget-visual-studio-options.md)
2021
### Package restore options
2122
#### [Restore packages](consume-packages/package-restore.md)
2223
#### [Troubleshooting](consume-packages/package-restore-troubleshooting.md)

docs/archive/project-json-and-uwp.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ ms.topic: conceptual
1212
> [!Important]
1313
> This content is deprecated. Projects should use the PackageReference formats.
1414
> 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.
1517
1618
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.
1719

docs/archive/project-json-impact.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ ms.topic: conceptual
1212
> [!Important]
1313
> This content is deprecated. Projects should use the PackageReference formats.
1414
> 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.
1517
1618
The `project.json` system used in NuGet 3+ affects package authors in several ways as described in the following sections.
1719

docs/archive/project-json.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ ms.topic: reference
1212
> [!Important]
1313
> This content is deprecated. Projects should use the PackageReference formats.
1414
> 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.
1517
1618
*NuGet 3.x*
1719

@@ -40,15 +42,35 @@ The [`project.lock.json`](#projectlockjson) file (described below) is also used
4042

4143
## Migrate project.json to PackageReference
4244

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:
4464

4565
1. Load the project.json project in Visual Studio.
4666
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...`
4868

4969
![Migrating from project.json to PackageReference](media/project-json-migrator.png)
5070

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).
5274

5375
## Dependencies
5476

docs/concepts/Auditing-Packages.md

Lines changed: 4 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: 05/05/2025
7+
ms.date: 10/01/2025
88
---
99

1010
# 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
2727
| [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|
2828
| [6.11](../release-notes/NuGet-6.11.md) | .NET 8 SDK (8.0.400) | Visual Studio 2022 17.11 | [NuGetAuditSuppress](#excluding-advisories) for PackageReference |
2929
| [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) |
3031

3132
## Running a security audit with `restore`
3233

@@ -157,7 +158,8 @@ If security vulnerabilities are found and updates are available for the package,
157158

158159
- Edit the `.csproj` or other package version location (`Directory.Packages.props`) with a newer version containing a security fix.
159160
- 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).
161163

162164
#### Transitive Packages
163165

docs/consume-packages/Package-References-in-Project-Files.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,14 @@ You can also set this conditional MSBuild property in your project file:
366366

367367
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.
368368

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+
369377
### Make lock file part of your source repository
370378

371379
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.

docs/consume-packages/Package-Restore.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ If the package references in your project file or your *packages.config* file ar
4444
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).
4545

4646
<a name="restore-using-visual-studio"></a>
47+
4748
## Restore packages in Visual Studio
4849

4950
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.
5253

5354
Configure the following Package Restore options at **Tools** > **Options** > **NuGet Package Manager** > **General**.
5455

55-
![Screenshot that shows the NuGet Package Manager options.](media/Restore-01-AutoRestoreOptions.png)
56+
![Screenshot that shows the NuGet Package Manager options.](media/vsoptions/general.png)
5657

5758
<a name="enable-and-disable-package-restore-in-visual-studio"></a>
59+
5860
#### Allow NuGet to download missing packages
5961

6062
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*
9092
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.
9193

9294
<a name="choose-default-package-management-format"></a>
95+
9396
#### Choose the default package management format
9497

9598
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.
9699

97100
> [!Note]
101+
>
98102
> - 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.
99103
>
100104
> - 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**.
101105
102106
<a name="restore-packages-automatically-using-visual-studio"></a>
103107
<a name="restore-packages-manually-using-visual-studio"></a>
108+
104109
### Restore packages manually or automatically
105110

106111
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
112117
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).
113118

114119
<a name="restore-using-the-dotnet-cli"></a>
120+
115121
## Restore by using the dotnet CLI
116122

117123
[!INCLUDE [restore-dotnet-cli](includes/restore-dotnet-cli.md)]
@@ -120,11 +126,13 @@ If you see the error **This project references NuGet package(s) that are missing
120126
> To add a missing package reference to the project file, use [dotnet add package](/dotnet/core/tools/dotnet-add-package), which also runs `restore`.
121127
122128
<a name="restore-using-the-nugetexe-cli"></a>
129+
123130
## Restore by using the NuGet CLI
124131

125132
[!INCLUDE [restore-nuget-exe-cli](includes/restore-nuget-exe-cli.md)]
126133

127134
<a name="restore-using-msbuild"></a>
135+
128136
## Restore by using MSBuild
129137

130138
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:
144152
145153
<a name="restore-using-azure-pipelines"></a>
146154
<a name="restore-using-azure-devops-server"></a>
155+
147156
## Restore with Azure Pipelines or Azure DevOps Server
148157

149158
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:
192201
- 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.
193202

194203
<a name="migrate-to-automatic-package-restore-visual-studio"></a>
204+
195205
## Migrate to automatic package restore
196206

197207
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

Comments
 (0)