Replies: 2 comments
-
Here's how it's used in the Roslyn project: Here's an example: IBrokeredServiceContainer serviceContainer;
IServiceBroker serviceBroker;
INuGetProjectService nugetService;
serviceContainer = await VS.GetServiceAsync<SVsBrokeredServiceContainer, IBrokeredServiceContainer>();
serviceBroker = serviceContainer?.GetFullAccessServiceBroker();
nugetService = await serviceBroker.GetProxyAsync<INuGetProjectService>(NuGetServices.NuGetProjectServiceV1, cancellationToken: default);
using (nugetService as IDisposable)
{
InstalledPackagesResult result;
result = await nugetService.GetInstalledPackagesAsync(projectId, CancellationToken.None);
foreach (NuGetInstalledPackage package in result.Packages)
{
Debug.WriteLine(package.Id);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Do you know if there is a way to get notified when one or more nuget packages are installed / removed without polling? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Visual Studio (2022) claims that:
But if I try
it thwows this:
How do I get hold of NuGet.VisualStudio.Contracts.INuGetProjectService ?
Beta Was this translation helpful? Give feedback.
All reactions