NuGet.VisualStudio.Contracts 17.9.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package NuGet.VisualStudio.Contracts --version 17.9.1
NuGet\Install-Package NuGet.VisualStudio.Contracts -Version 17.9.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NuGet.VisualStudio.Contracts" Version="17.9.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NuGet.VisualStudio.Contracts --version 17.9.1
#r "nuget: NuGet.VisualStudio.Contracts, 17.9.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NuGet.VisualStudio.Contracts as a Cake Addin
#addin nuget:?package=NuGet.VisualStudio.Contracts&version=17.9.1

// Install NuGet.VisualStudio.Contracts as a Cake Tool
#tool nuget:?package=NuGet.VisualStudio.Contracts&version=17.9.1

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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on NuGet.VisualStudio.Contracts:

Repository Stars
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
Version Downloads Last updated
17.9.1 178 2/13/2024
17.8.1 115 2/13/2024
17.8.0 299 11/17/2023
17.7.1 96 2/14/2024
17.7.0 423 8/9/2023
17.6.2 80 2/13/2024
17.6.1 237 6/13/2023
17.6.0 429 5/17/2023
17.6.0-preview.3 68 5/17/2023
17.5.1 212 6/13/2023
17.5.0 469 2/22/2023
17.4.3 75 2/13/2024
17.4.2 136 6/13/2023
17.4.0 727 11/9/2022
17.3.4 79 2/13/2024
17.3.3 141 6/14/2023
17.3.1 650 10/11/2022
17.2.4 138 6/14/2023
17.2.2 374 10/11/2022
17.1.0 638 2/16/2022
6.0.6 90 2/13/2024
6.0.5 178 6/13/2023
6.0.3-rc.1 98 10/11/2022
6.0.2 433 6/14/2022
5.11.6 89 2/13/2024
5.11.5 153 6/15/2023
5.11.3 1,290 10/11/2022
5.10.0 3,757 6/15/2021
5.9.3 372 10/11/2022
5.8.1 151 1/16/2021
5.7.3-rtm.5 96 10/11/2022
5.7.2 412 6/14/2022