Skip to content

Commit e1caa83

Browse files
authored
Update VS extensibility API doc (#3484)
1 parent 0e96e39 commit e1caa83

File tree

1 file changed

+33
-74
lines changed

1 file changed

+33
-74
lines changed

docs/visual-studio-extensibility/nuget-api-in-visual-studio.md

Lines changed: 33 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ From NuGet 6.0, all of these APIs are available in the package [NuGet.VisualStud
4949
- [`IVsFrameworkCompatibility3`](#ivsframeworkcompatibility3-interface) Contains methods to discover frameworks and compatibility between frameworks. (5.8+)
5050
- [`IVsFrameworkParser`](#ivsframeworkparser-interface) An interface for dealing with the conversion between strings and [FrameworkName](/dotnet/api/system.runtime.versioning.frameworkname) (4.0+)
5151
- [`IVsFrameworkParser2`](#ivsframeworkparser2-interface) An interface to parse .NET Framework strings. See [NuGet-IVsFrameworkParser](https://aka.ms/NuGet-IVsFrameworkParser). (5.8+)
52-
- [`IVsGlobalPackagesInitScriptExecutor`](#ivsglobalpackagesinitscriptexecutor-interface) Execute powershell scripts from package(s) in a solution (4.0+)
5352
- [`IVsPackageInstaller`](#ivspackageinstaller-interface): Methods to install NuGet packages into projects. (3.3+)
5453
- [`IVsPackageInstaller2](#ivspackageinstaller2-interface) Contains method to install latest version of a single package into a project within the current solution.
5554
- [`IVsPackageInstallerEvents`](#ivspackageinstallerevents-interface): Events for package install/uninstall. (3.3+)
5655
- [`IVsPackageInstallerProjectEvents`](#ivspackageinstallerprojectevents-interface): Batch events for package install/uninstall. (3.3+)
5756
- [`IVsPackageInstallerServices`](#ivspackageinstallerservices-interface): Methods to retrieve installed packages in the current solution and to check whether a given package is installed in a project. (3.3+)
58-
- [`IVsPackageManagerProvider`](#ivspackagemanagerprovider-interface): Methods to provide alternative Package Manager suggestions for a NuGet package. (3.3 - 5.11)
5957
- [`IVsPackageRestorer`](#ivspackagerestorer-interface): Methods to restore packages installed in a project. (3.3+)
6058
- [`IVsPackageSourceProvider`](#ivspackagesourceprovider-interface): Methods to retrieve a list of NuGet package sources. (3.3+)
6159
- [`IVsPackageUninstaller`](#ivspackageuninstaller-interface): Methods to uninstall NuGet packages from projects. (3.3+)
@@ -75,6 +73,7 @@ These interfaces are designed for project systems to interact with NuGet, allowi
7573
- [`IVsSolutionRestoreService2`](#ivssolutionrestoreservice2-interface) (4.3+)
7674
- [`IVsSolutionRestoreService3`](#ivssolutionrestoreservice3-interface) (5.1+)
7775
- [`IVsSolutionRestoreService4`](#ivssolutionrestoreservice4-interface) (6.0+)
76+
- [`IVsSolutionRestoreService5`](#ivssolutionrestoreservice5-interface) (6.11+)
7877
- [`IVsSolutionRestoreStatusProvider`](#ivssolutionrestorestatusprovider-interface) (6.0+)
7978

8079
## Using NuGet Services
@@ -414,31 +413,6 @@ public interface IRegistryKey
414413
}
415414
```
416415

417-
## IVsGlobalPackagesInitScriptExecutor interface
418-
419-
```cs
420-
/// <summary>
421-
/// Execute powershell scripts from package(s) in a solution
422-
/// </summary>
423-
/// <remarks>Intended for internal use only.</remarks>
424-
public interface IVsGlobalPackagesInitScriptExecutor
425-
{
426-
/// <summary>
427-
/// Executes the init script of the given package if available.
428-
/// 1) If the init.ps1 script has already been executed by the powershell host, it will not be executed again.
429-
/// True is returned.
430-
/// 2) If the package is found in the global packages folder it will be used.
431-
/// If not, it will return false and do nothing.
432-
/// 3) Also, note if other scripts are executing while this call was made, it will wait for them to complete.
433-
/// </summary>
434-
/// <param name="packageId">Id of the package whose init.ps1 will be executed.</param>
435-
/// <param name="packageVersion">Version of the package whose init.ps1 will be executed.</param>
436-
/// <returns>Returns true if the script was executed or has been executed already.</returns>
437-
/// <remarks>This method throws if the init.ps1 being executed throws.</remarks>
438-
Task<bool> ExecuteInitScriptAsync(string packageId, string packageVersion);
439-
}
440-
```
441-
442416
## IVsPackageInstaller interface
443417

444418
```cs
@@ -810,53 +784,6 @@ public interface IRegistryKey
810784
}
811785
```
812786

813-
## IVsPackageManagerProvider interface
814-
815-
This interface was primarily used by the ASP.NET team, to suggest that Javascript and CSS packages like `jQuery` and `bootstrap` are installed with Bower instead of NuGet. Since they removed that functionality From Visual Studio, NuGet has obsolete this interface, and it will no longer be used by the Package Manager UI in Visual Studio 2022 (version 17.0) and later.
816-
817-
```cs
818-
/// <summary>
819-
/// Interface allowing integration of alternate package manager suggestion for a NuGet package.
820-
/// For example jQuery may appear on Bower and npm,
821-
/// it might be more appropriate to install a package from them for certain projects.
822-
/// </summary>
823-
[Obsolete]
824-
public interface IVsPackageManagerProvider
825-
{
826-
/// <summary>
827-
/// Localized display package manager name.
828-
/// </summary>
829-
string PackageManagerName { get; }
830-
831-
/// <summary>
832-
/// Package manager unique id.
833-
/// </summary>
834-
string PackageManagerId { get; }
835-
836-
/// <summary>
837-
/// The tool tip description for the package
838-
/// </summary>
839-
string Description { get; }
840-
841-
/// <summary>
842-
/// Check if a recommendation should be surfaced for an alternate package manager.
843-
/// This code should not rely on slow network calls, and should return rapidly.
844-
/// </summary>
845-
/// <param name="packageId">Current package id</param>
846-
/// <param name="projectName">Unique project name for finding the project through VS dte</param>
847-
/// <param name="token">Cancellation Token</param>
848-
/// <returns>return true if need to direct to integrated package manager for this package</returns>
849-
Task<bool> CheckForPackageAsync(string packageId, string projectName, CancellationToken token);
850-
851-
/// <summary>
852-
/// This Action should take the user to the other package manager.
853-
/// </summary>
854-
/// <param name="packageId">Current package id</param>
855-
/// <param name="projectName">Unique project name for finding the project through VS dte</param>
856-
void GoToPackage(string packageId, string projectName);
857-
}
858-
```
859-
860787
## IVsPackageRestorer interface
861788

862789
```cs
@@ -1249,6 +1176,7 @@ This interface was primarily used by the ASP.NET team, to suggest that Javascrip
12491176
/// <exception cref="ArgumentException">Thrown if <paramref name="projectUniqueName" /> is not the path of a project file.</exception>
12501177
/// <exception cref="ArgumentNullException">Thrown if <paramref name="projectRestoreInfo" /> is <c>null</c>.</exception>
12511178
/// <exception cref="OperationCanceledException">Thrown if <paramref name="token" /> is cancelled.</exception>
1179+
[Obsolete("Use IVsSolutionRestoreService5 instead")]
12521180
Task<bool> NominateProjectAsync(string projectUniqueName, IVsProjectRestoreInfo projectRestoreInfo, CancellationToken token);
12531181
}
12541182
```
@@ -1315,6 +1243,7 @@ This interface was primarily used by the ASP.NET team, to suggest that Javascrip
13151243
/// <exception cref="ArgumentException">Thrown if <paramref name="projectUniqueName" /> is not the path of a project file.</exception>
13161244
/// <exception cref="ArgumentNullException">Thrown if <paramref name="projectRestoreInfo" /> is <c>null</c>.</exception>
13171245
/// <exception cref="OperationCanceledException">Thrown if <paramref name="token" /> is cancelled.</exception>
1246+
[Obsolete("Use IVsSolutionRestoreService5 instead")]
13181247
Task<bool> NominateProjectAsync(string projectUniqueName, IVsProjectRestoreInfo2 projectRestoreInfo, CancellationToken token);
13191248
}
13201249
```
@@ -1342,6 +1271,36 @@ This interface was primarily used by the ASP.NET team, to suggest that Javascrip
13421271
}
13431272
```
13441273

1274+
## IVsSolutionRestoreService5 interface
1275+
1276+
```cs
1277+
/// <summary>
1278+
/// Represents a package restore service API for integration with a project system.
1279+
/// Implemented by NuGet.
1280+
/// </summary>
1281+
public interface IVsSolutionRestoreService5 : IVsSolutionRestoreService4
1282+
{
1283+
/// <summary>
1284+
/// An entry point used by CPS to indicate given project needs to be restored.
1285+
/// </summary>
1286+
/// <param name="projectUniqueName">
1287+
/// The full path to the project file. In the VS SDK's IVsSolution, this is also known as the unique name.
1288+
/// </param>
1289+
/// <param name="projectRestoreInfo">Metadata <see cref="IVsProjectRestoreInfo3"/> needed for restoring the project.</param>
1290+
/// <param name="token">Cancellation token.</param>
1291+
/// <returns>
1292+
/// Returns a restore task corresponding to the nominated project request.
1293+
/// NuGet will batch restore requests so it's possible the same restore task will be returned for multiple projects.
1294+
/// When the requested restore operation for the given project completes the task will indicate operation success or failure.
1295+
/// </returns>
1296+
/// <exception cref="ArgumentException">Thrown if <paramref name="projectUniqueName" /> is not the path of a project file,
1297+
/// or if <paramref name="projectRestoreInfo"/> has some basic validation errors.</exception>
1298+
/// <exception cref="ArgumentNullException">Thrown if <paramref name="projectRestoreInfo" /> is <see langword="null" />.</exception>
1299+
/// <exception cref="OperationCanceledException">Thrown if <paramref name="token" /> is cancelled.</exception>
1300+
Task<bool> NominateProjectAsync(string projectUniqueName, IVsProjectRestoreInfo3 projectRestoreInfo, CancellationToken token);
1301+
}
1302+
```
1303+
13451304
## IVsProjectRestoreInfoSource interface
13461305

13471306
```cs

0 commit comments

Comments
 (0)