Skip to main content

RPC contracts for NuGet's Visual Studio Service Broker extensibility APIs.

Total Downloads
144.5K
144,534
Published
May 13, 2025
1y ago

Get Started

dotnet add package NuGet.VisualStudio.Contracts --version 17.14.0
ProductVersions
.NET Standard
netstandard2.0

README

NuGet.VisualStudio.Contracts

The package NuGet.VisualStudio.Contracts contains RPC contracts for NuGet’s Visual Studio Service Broker extensibility APIs. These APIs are designed to be usable with async code and are available in this package using Visual Studio’s IServiceBroker.

Usage

Install the NuGet.VisualStudio.Contracts package into your project, as well as Microsoft.VisualStudio.SDK.

Use the IAsyncServiceProvider to get Visual Studio's service broker, and use that to get NuGet's service. Note that AsyncPackage extends IVsAsyncServiceProvider2, so your class that implements AsyncPackage can be used as the IAsyncServiceProvider. Also see the docs on IBrokeredServiceContainer and IServiceBroker

// Your AsyncPackage implements IAsyncServiceProvider
IAsyncServiceProvider asyncServiceProvider = this;
var brokeredServiceContainer = await asyncServiceProvider.GetServiceAsync<SVsBrokeredServiceContainer, IBrokeredServiceContainer>();
IServiceBroker serviceBroker = brokeredServiceContainer.GetFullAccessServiceBroker();
INuGetProjectService nugetProjectService = await serviceBroker.GetProxyAsync<INuGetProjectService>(NuGetServices.NuGetProjectServiceV1);

Example

Get installed packages of a project.

InstalledPackagesResult installedPackagesResult;
using (nugetProjectService as IDisposable)
{
    installedPackagesResult = await nugetProjectService.GetInstalledPackagesAsync(projectGuid, cancellationToken);
}

Additional documentation

More information about the NuGet.VisualStudio.Contracts library can be found on the NuGet API docs.

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.