### GitHub Actions Workflow for Copilot Setup
Source: https://github.com/nuget/home/blob/dev/mcp/README.md
This YAML workflow automates the setup steps for GitHub Copilot, including installing a specific .NET version. The job must be named 'copilot-setup-steps' for Copilot to recognize it.
```yaml
name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest
# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
contents: read
# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- name: Install .NET 10.x
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
10.x
dotnet-quality: preview
- name: dotnet --info
run: dotnet --info
```
--------------------------------
### Example: Verify with Detailed Verbosity
Source: https://github.com/nuget/home/wiki/NuGet-Verify-Command
Shows how to use the -Verbosity option to get detailed output during the package verification process.
```bash
NuGet verify -Signatures "C:\path\to\your\package.nupkg" -Verbosity detailed
```
--------------------------------
### Search Results Example
Source: https://github.com/nuget/home/blob/dev/accepted/archive/SearchCommandSpec.md
Example output of a successful NuGet.exe search command, displaying package name, version, download count, and a description preview.
```text
====================
Source: NuGet.org
--------------------
> Microsoft.Extensions.Logging.Abstractions | 5.0.0-preview.6.20305.6 | Downloads: 345,145,935
Logging abstractions for Microsoft.Extensions.Logging.
Commonly Used Types:
Microsoft.Extensions.Lo...
--------------------
> Microsoft.Extensions.Logging | 5.0.0-preview.6.20305.6 | Downloads: 243,186,566
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
When using NuGet 3....
--------------------
> Microsoft.IdentityModel.Logging | 6.6.0 | Downloads: 120,177,247
Includes Event Source based logging support.
--------------------
> Microsoft.Extensions.Logging.Configuration | 5.0.0-preview.6.20305.6 | Downloads: 63,205,816
```
--------------------------------
### Package References for Scenario 1F
Source: https://github.com/nuget/home/blob/dev/accepted/2021/PackageSourceMapping.md
Example package references for Scenario 1F, demonstrating package installation from 'contoso' and potential inconsistencies.
```xml
```
--------------------------------
### Complete Package Source Mapping Example
Source: https://github.com/nuget/home/blob/dev/accepted/2021/PackageSourceMapping.md
An example `NuGet.config` demonstrating package source definitions and detailed mapping for multiple sources, including exact package ID pinning.
```xml
```
--------------------------------
### Package References for Scenario 1D
Source: https://github.com/nuget/home/blob/dev/accepted/2021/PackageSourceMapping.md
Example package references for Scenario 1D, illustrating a scenario where some packages might fail to install due to missing patterns.
```xml
```
--------------------------------
### ZenHub Release Client Example (C#)
Source: https://github.com/nuget/home/blob/dev/accepted/2020/ClientDevProcess.md
An example of how to use the ZenHub API in C# to interact with release reports. This snippet shows a specific method for fetching release data.
```csharp
public async Task> GetIssuesForReleaseAsync(long workspaceId, long repoId, long releaseId)
{
var request = new RestRequest($"workspaces/{workspaceId}/repositories/{repoId}/reports/release/{releaseId}/issues");
return await _client.GetAsync>(request);
}
```
--------------------------------
### No Results Found Example
Source: https://github.com/nuget/home/blob/dev/accepted/archive/SearchCommandSpec.md
Example output when a specific package source returns no results for a given search query.
```text
====================
Source: dotnet-msbuild
--------------------
No results found.
```
--------------------------------
### Example Dotnet List Package Output (Default Format)
Source: https://github.com/nuget/home/blob/dev/accepted/2022/DotnetListPackageMachineReadableJsonOutput.md
This is an example of the default, human-readable output from the `dotnet list package` command, showing package references for different project targets.
```text
Project 'MyProjectA' has the following package references
[netcoreapp3.1]:
Top-level Package Requested Resolved
> Microsoft.Extensions.Primitives [1.0.0, 5.0.0] 1.0.0
> NuGet.Commands 4.8.0-preview3.5278 4.8.0-preview3.5278
> Text2Xml.Lib [1.1.2, 2.0.0) 1.1.2
Project 'MyProjectB' has the following package references
[netcoreapp3.1]:
Top-level Package Requested Resolved
> NuGet.Commands 4.8.0-preview3.5278 4.8.0-preview3.5278
> Text2Xml.Lib 1.1.2 1.1.2
[net5.0]:
Top-level Package Requested Resolved
> NuGet.Commands 4.8.0-preview3.5278 4.8.0-preview3.5278
> Text2Xml.Lib 1.1.2 1.1.2
```
--------------------------------
### Example dotnet list package output
Source: https://github.com/nuget/home/wiki/[Spec]-Machine-readable-output-for-dotnet-list-package
This is an example of the default, human-readable output for the `dotnet list package` command, showing package references for different projects and frameworks.
```text
Project 'MyProjectA' has the following package references
[netcoreapp3.1]:
Top-level Package Requested Resolved
> Microsoft.Extensions.Primitives [1.0.0, 5.0.0] 1.0.0
> NuGet.Commands 4.8.0-preview3.5278 4.8.0-preview3.5278
> Text2Xml.Lib [1.1.2, 2.0.0) 1.1.2
Project 'MyProjectB' has the following package references
[netcoreapp3.1]:
Top-level Package Requested Resolved
> NuGet.Commands 4.8.0-preview3.5278 4.8.0-preview3.5278
> Text2Xml.Lib 1.1.2 1.1.2
[net5.0]:
Top-level Package Requested Resolved
> NuGet.Commands 4.8.0-preview3.5278 4.8.0-preview3.5278
> Text2Xml.Lib 1.1.2 1.1.2
```
--------------------------------
### Example User-Agent Formats with CI Context
Source: https://github.com/nuget/home/blob/dev/accepted/2026/ci-useragent-nuget.md
These examples illustrate the User-Agent header format when different CI environments are detected. The format includes the base user-agent, NuGet version, and detected CI client ID and environment.
```text
NuGet xplat/6.10.0 (Microsoft Windows NT; CI: GitHubActions)
```
```text
NuGet xplat/6.10.0 (Linux; CI: AzureDevOps)
```
```text
NuGet xplat/6.10.0 (Linux; CI: other)
```
--------------------------------
### List All Installed Packages
Source: https://github.com/nuget/home/wiki/dotnet-list-package
Run this command in the project folder to display all installed NuGet packages, including top-level and transitive ones. It shows the requested and resolved versions for each package.
```bash
> dotnet list package
Project '.\project.csproj' has the following package references
[netstandard1.0]:
Top-level Package Requested Resolved
> NETStandard.Library (A) 2.0.3 2.0.3
> nuget.versioning [4.0.0, 4.3.0) 4.0.0
> SlowCheetah.Xdt 1.0.1-beta 1.0.1-beta
[net45]:
Transitive Package Requested Resolved
> NETStandard.Library (A) 2.0.3 2.0.3
> nuget.versioning [4.0.0, 4.3.0) 4.0.0
> SlowCheetah.Xdt 1.0.1-beta 1.0.1-beta
(A) : Auto-referenced package
>
```
--------------------------------
### Example NuGet Configuration with Trusted Signers
Source: https://github.com/nuget/home/wiki/[Spec]-NuGet-Config-schema-changes-to-enable-trusted-signers
Illustrates a complete nuget.config file including package sources and detailed trusted signer configurations for both repositories and authors. This example shows multiple certificates per repository and owner lists.
```xml
aspnet;microsoft
```
--------------------------------
### Project file with FrameworkReference
Source: https://github.com/nuget/home/wiki/[Spec]-FrameworkReference-in-NuGet
Example of how to declare a FrameworkReference in a project file.
```xml
```
--------------------------------
### Project with AssetTargetFallback
Source: https://github.com/nuget/home/blob/dev/accepted/2022/AssetTargetFallback-DependenciesResolution.md
Example project configuration specifying a target framework and AssetTargetFallback.
```xml
...
netcoreapp3.0
net461;net48
...
...
```
--------------------------------
### Example of floating version with pre-release inclusion
Source: https://github.com/nuget/home/blob/dev/accepted/archive/FloatingStableAndPrerelease.md
Demonstrates the new `*-*` syntax for floating versions, allowing selection of the absolute latest package, whether stable or pre-release. This example specifically targets pre-release versions ending in 'rc'.
```markdown
| Floating Version | Available Versions | Best Version |
| -----------------|--------------------|-----------------------|
| 5.*-rc.* | 4.9.0
5.1.0
5.2.0-beta.1
5.2.0-rc.3
6.0.0-rc.1 | [5.2.0-rc.3](https://nugettoolsdev.azurewebsites.net/5.5.0-floating.7611/find-best-version-match?versionRange=5.*-rc.*&versions=4.9.0%0D%0A5.1.0%0D%0A5.2.0-beta.1%0D%0A5.2.0-rc.3%0D%0A6.0.0-rc.1) |
```
--------------------------------
### Example: Verify with Config File
Source: https://github.com/nuget/home/wiki/NuGet-Verify-Command
Demonstrates using the -ConfigFile option to specify a NuGet.Config file for repository signature verification.
```bash
NuGet verify -Signatures "C:\path\to\your\package.nupkg" -ConfigFile "C:\path\to\your\NuGet.Config"
```
--------------------------------
### Get NuGet Package Installer Service Proxy
Source: https://github.com/nuget/home/blob/dev/accepted/archive/NuGetExtensibility/NuGetExtensibilityServices.md
On the client side, this code retrieves a proxy to the NuGet package installer service from the service broker.
```csharp
IBrokeredServiceContainer brokeredServiceContainer = await this.GetServiceAsync();
Assumes.Present(brokeredServiceContainer);
IServiceBroker sb = brokeredServiceContainer.GetFullAccessServiceBroker();
INuGetPackageInstaller client = await sb.GetProxyAsync(NuGetPackageInstallerServiceDescriptor, this.DisposalToken);
```
--------------------------------
### Example: Verify Package Signatures
Source: https://github.com/nuget/home/wiki/NuGet-Verify-Command
Demonstrates how to use the NuGet verify command with the -Signatures flag to verify a package.
```bash
NuGet verify -Signatures "C:\path\to\your\package.nupkg"
```
--------------------------------
### Get All Merged NuGet Configuration Settings (Non-XML)
Source: https://github.com/nuget/home/blob/dev/accepted/2022/dotnet-nuget-config-spec.md
Illustrates the output format for retrieving all merged configuration settings when they are not in XML format. This includes examples for packageSources, packageSourceMapping, and packageRestore sections.
```text
packageSources:
clear
add key="source1" value="https://test/source1/v3/index.json"
add key="source2" value="https://test/source2/v3/index.json"
packageSourceMapping:
clear
packageSource key="source1" pattern="microsoft.*","nuget.*"
packageSource key="source2" pattern="system.*"
packageRestore:
add key="enabled" value="False"
add key="automatic" value="False"
```
--------------------------------
### Correct Build Props/Targets Convention Example
Source: https://github.com/nuget/home/blob/dev/accepted/archive/PackageValidation/BuildPropsConventionIsUpheld.md
Demonstrates the correct file structure for build props and targets files within a NuGet package, adhering to the `.props` and `.targets` convention for each target framework.
```text
/lib
/build
/net45
/test.package.props
/test.package.targets
/netstandard2.0
/test.package.props
/test.package.targets
```
--------------------------------
### Example Local Configuration File
Source: https://github.com/nuget/home/blob/dev/accepted/archive/UserWideConfiguration-AdditionalExtensibilityFolders.md
This XML snippet shows the structure of a local solution configuration file.
```xml
```
--------------------------------
### Alternative MCP Server Configuration JSON
Source: https://github.com/nuget/home/blob/dev/accepted/2025/nuget-mcp.md
An alternative MCP server configuration JSON example, potentially used for different scenarios or versions. This snippet shows a simplified server configuration without input prompts, focusing on the command and arguments for starting the MCP server.
```json
{
"servers": {
"Contoso.MySuperMcp": {
"type": "stdio",
"command": "dnx",
"args": ["Contoso.MySuperMcp", "--version", "1.0.1"]
}
}
}
```
--------------------------------
### Sample Package Directory Structure
Source: https://github.com/nuget/home/blob/dev/accepted/archive/PackageValidation/RefAssembliesInNuspecMatchRefFolder.md
Illustrates a typical NuGet package directory layout, including 'lib' and 'ref' folders with assemblies for different target frameworks.
```text
lib\
net472\
MyLib.dll
MyHelpers.dll
MyUtilities.dll
ref\
net472\
MyLib.dll
MyHelpers.dll
```
--------------------------------
### Example MCP Server Configuration JSON
Source: https://github.com/nuget/home/blob/dev/accepted/2025/nuget-mcp.md
This JSON structure represents the startup instructions for an MCP server. It includes input definitions for user prompts and server configurations, specifying the command, arguments, and environment variables required to start the server. This format is used when embedding `server.json` or when scraping from a README.
```json
{
"inputs": [
{
"type": "promptString",
"id": "contoso-api-key",
"description": "Contoso API Key",
"password": true
}
],
"servers": {
"Contoso.MySuperMcp": {
"type": "stdio",
"command": "dnx",
"args": ["Contoso.MySuperMcp", "--", "mcp", "start"],
"env": {
"CONTOSO_API_KEY": "${input:contoso-api-key}"
}
}
}
}
```
--------------------------------
### Nuspec example with FrameworkReference
Source: https://github.com/nuget/home/wiki/[Spec]-FrameworkReference-in-NuGet
Illustrates a nuspec file structure including framework references.
```xml
LibraryA
1.0.0
Microsoft
Microsoft
```
--------------------------------
### Pinned PackageVersion Example
Source: https://github.com/nuget/home/wiki/Centrally-managing-NuGet-package-versions
Example of a PackageVersion element in Directory.Packages.props that is pinned and will not be removed by the prune command.
```xml
```
--------------------------------
### Install NuGet Credential Provider as a Global Tool
Source: https://github.com/nuget/home/blob/dev/accepted/2024/support-nuget-authentication-plugins-dotnet-tools.md
Install the credential provider as a global .NET tool using the `dotnet tool install -g` command. This makes the tool available system-wide and allows NuGet to discover it during restore operations.
```bash
dotnet tool install -g Microsoft.CredentialProvider
```
--------------------------------
### List All Packages in Solution
Source: https://github.com/nuget/home/wiki/dotnet-list-package
Run `dotnet list package` without any options to display a list of all packages installed in the solution.
```bash
> dotnet list package
--------------------------------------------------------
--------------------------------------------------------
```
--------------------------------
### Package References for Scenario 1A
Source: https://github.com/nuget/home/blob/dev/accepted/2021/PackageSourceMapping.md
Example package references for Scenario 1A, demonstrating packages from different namespaces.
```xml
```
--------------------------------
### Example Dependency Resolution Output
Source: https://github.com/nuget/home/blob/dev/accepted/2022/AssetTargetFallback-DependenciesResolution.md
Illustrates the resolved list of packages for different target frameworks after dependency resolution.
```text
net472:
X 1.0.0
Y 2.0.0
W 3.0.0
netstandard2.0:
X 1.0.0
Z 3.0.1
W 2.1.0
```
--------------------------------
### InstalledPackagesResult
Source: https://github.com/nuget/home/blob/dev/accepted/archive/NuGetExtensibility/INuGetProjectServices.md
Represents the result of retrieving installed packages from a project. It includes the status of the operation and a collection of installed packages.
```APIDOC
## InstalledPackagesResult
### Description
Result of a call to `INuGetProjectService.GetInstalledPackagesAsync`. Use `NuGetContractsFactory.CreateInstalledPackagesResult` to create an instance.
### Properties
- **Status** (InstalledPackageResultStatus) - The status of the result.
- **Packages** (IReadOnlyCollection) - List of packages in the project. May be null if `Status` was not successful.
```
--------------------------------
### NuGet Search Syntax for Frameworks, Platforms, and Implementations
Source: https://github.com/nuget/home/blob/dev/accepted/2022/TargetFrameworkAndPlatformsFilters.md
Use these search syntax examples to filter NuGet packages by target framework monikers, supported platforms, or .NET generation. The `implementation:` filter includes all frameworks of a given generation.
```text
framework:net472 framework:net471 framework:net47 # Match the target framework monikers
```
```text
platform:windows platform:macos platform:linux # Match the platforms
```
```text
implementation:netframework implementation:netcore implementation:net # Match the generation of .NET including both supported frameworks & platforms.
```
--------------------------------
### Check if NuGet Package is Installed
Source: https://github.com/nuget/home/wiki/[Spec]-Package-download-API
This method checks if a specific NuGet package with a given version is already installed.
```csharp
public static async Task IsPackageInstalled(string packageId, string version);
```
--------------------------------
### Basic Floating Version Example
Source: https://github.com/nuget/home/wiki/Support-pre-release-packages-with-floating-versions
This example shows a basic floating version declaration that currently only includes stable package versions.
```xml
```
--------------------------------
### ODataV2CuratedFeedController - Get Endpoint
Source: https://github.com/nuget/home/wiki/SemVer2-support-for-nuget.org-(server-side)
This C# method signature is for the Get endpoint of the OData V2 curated feed controller, supporting SemVer 2.0.0.
```csharp
public async Task Get(
ODataQueryOptions options,
[FromODataUri]string curatedFeedName,
[FromUri]string semVerLevel = null)
```
--------------------------------
### Example User Configuration File
Source: https://github.com/nuget/home/blob/dev/accepted/archive/UserWideConfiguration-AdditionalExtensibilityFolders.md
This XML snippet shows the structure of the default user-wide configuration file.
```xml
```
--------------------------------
### Example: Verify with Certificate Fingerprint
Source: https://github.com/nuget/home/wiki/NuGet-Verify-Command
Shows how to verify a package and match the signer certificate against a specific SHA256 fingerprint.
```bash
NuGet verify -Signatures "C:\path\to\your\package.nupkg" -CertificateFingerprint "A1B2C3D4E5F6..."
```
--------------------------------
### Define NuGet Package Installer Contract
Source: https://github.com/nuget/home/blob/dev/accepted/archive/NuGetExtensibility/NuGetExtensibilityServices.md
Defines the interface for a NuGet package installer service. This contract is used for RPC communication and should only be implemented by NuGet.
```csharp
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
namespace NuGet.VisualStudio.Contracts
{
public interface INuGetPackageInstaller
{
Task InstallPackageAsync(
string source,
string project,
string packageId,
string version,
CancellationToken cancellationToken);
}
}
```
--------------------------------
### Proffer NuGet Package Installer Service
Source: https://github.com/nuget/home/blob/dev/accepted/archive/NuGetExtensibility/NuGetExtensibilityServices.md
Obtains the brokered service container and proffers the NuGet package installer service. Each client receives its own instance of the service.
```csharp
IBrokeredServiceContainer brokeredServiceContainer = await this.GetServiceAsync();
brokeredServiceContainer.Proffer(NuGetPackageInstallerServiceDescriptor, factory: ServicesUtility.GetPackageInstallerServiceFactory());
```
--------------------------------
### Example output of vulnerable packages
Source: https://github.com/nuget/home/blob/dev/accepted/2020/PackageVulnerability/DotnetListPackageVulnerable.md
This is an example of the output you might see when running the `dotnet list package --vulnerable` command, showing vulnerable packages and their details.
```shell
> dotnet list package --vulnerable
The following sources were used:
nuget.org - https://api.nuget.org/v3/index.json
Local - C:\\NuGet\\NuGetLocal
Project `ClassLibrary1` uses the following vulnerable packages
[netcoreapp2.0]:
Top-level Package Requested Resolved Severity Vulnerability
> My.Vulnerable.Package 2.0.0 2.0.0 Low https://URL-to-vuln-details
> My.Fixed.Package 1.1.0 1.1.0 Critical https://URL-to-vuln-details
```
--------------------------------
### Example Package Assets
Source: https://github.com/nuget/home/blob/dev/accepted/2022/AssetTargetFallback-DependenciesResolution.md
Illustrates the available DLL assets for a package across different .NET Framework versions.
```text
lib/net472/b.dll
lib/net462/b.dll
```
--------------------------------
### Package Structure Example
Source: https://github.com/nuget/home/wiki/Enable-.NET-Core-2.0-projects-to-work-with-.NET-Framework-4.6.1-compatible-packages
Illustrates the directory structure of a NuGet package with assets for different target frameworks, including netstandard2.0, net461, and uap.
```text
PackageA
\build
\netstandard2.0
\foo.targets
\net461
\bar.targets
\uap
\zar.targets
\lib
\netstandard2.0
\libfoo.dll
\net461
\libfoo.dll
\libbar.dll
\uap
\libfoo.dll
\libbar.dll
\ref
\net461
\libfoo.dll
\libbar.dll
\uap
\libfoo.dll
\libbar.dll
```
--------------------------------
### Install NuGet Credential Provider Plugin
Source: https://github.com/nuget/home/blob/dev/accepted/2024/support-nuget-authentication-plugins-dotnet-tools.md
Installs the specified credential provider as a .NET global tool. This command should be run before `dotnet restore` when accessing private feeds.
```bash
dotnet nuget plugin install Microsoft.CredentialProvider
```