### Installation Compatibility Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Provides access to the singleton instance for installation compatibility checks. ```APIDOC ## Instance ### Description Gets the singleton instance of the InstallationCompatibility class. ### Method static property accessor ### Signature ```csharp static NuGet.PackageManagement.InstallationCompatibility Instance { get; } ``` ``` -------------------------------- ### Package Installation Methods Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Packaging/PublicAPI/net8.0/PublicAPI.Shipped.txt Facilitates the installation of packages from a source. ```APIDOC ## InstallFromSourceAsync (PackageDownloader) ### Description Installs a package from a source asynchronously using an IPackageDownloader. ### Method static ### Signature InstallFromSourceAsync(PackageIdentity packageIdentity, IPackageDownloader packageDownloader, VersionFolderPathResolver versionFolderPathResolver, PackageExtractionContext packageExtractionContext, CancellationToken token, Guid parentId = default(Guid)) -> Task ``` ```APIDOC ## InstallFromSourceAsync (Func) ### Description Installs a package from a source asynchronously using a function to copy the stream. ### Method static ### Signature InstallFromSourceAsync(string source, PackageIdentity packageIdentity, Func copyToAsync, VersionFolderPathResolver versionFolderPathResolver, PackageExtractionContext packageExtractionContext, CancellationToken token, Guid parentId = default(Guid)) -> Task ``` -------------------------------- ### Preview Install Package Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Provides methods to preview the installation of a package into a single NuGet project. ```APIDOC ## PreviewInstallPackageAsync ### Description Previews the installation of a specified package into a NuGet project. This method allows you to see the project actions that would result from an installation without actually performing it. ### Method `PreviewInstallPackageAsync` ### Parameters - `nuGetProject` (NuGetProject) - The project to install the package into. - `packageIdentity` (PackageIdentity) - The identity of the package to install. - `resolutionContext` (ResolutionContext) - The context for resolving package dependencies. - `nuGetProjectContext` (INuGetProjectContext) - The context for NuGet project operations. - `primarySources` (IEnumerable) - A collection of primary package sources. - `secondarySources` (IEnumerable) - A collection of secondary package sources. - `versionRange` (VersionRange) - The version range for the package to install. - `token` (CancellationToken) - A token to monitor for cancellation requests. ### Returns `Task>` - A task that represents the asynchronous operation, returning a collection of project actions that would be performed. ``` ```APIDOC ## PreviewInstallPackageAsync ### Description Previews the installation of a specified package into a NuGet project, without requiring a specific version range. ### Method `PreviewInstallPackageAsync` ### Parameters - `nuGetProject` (NuGetProject) - The project to install the package into. - `packageIdentity` (PackageIdentity) - The identity of the package to install. - `resolutionContext` (ResolutionContext) - The context for resolving package dependencies. - `nuGetProjectContext` (INuGetProjectContext) - The context for NuGet project operations. - `primarySources` (IEnumerable) - A collection of primary package sources. - `secondarySources` (IEnumerable) - A collection of secondary package sources. - `token` (CancellationToken) - A token to monitor for cancellation requests. ### Returns `Task>` - A task that represents the asynchronous operation, returning a collection of project actions that would be performed. ``` ```APIDOC ## PreviewInstallPackageAsync ### Description Previews the installation of a package by its ID into a NuGet project, using a single primary source repository. ### Method `PreviewInstallPackageAsync` ### Parameters - `nuGetProject` (NuGetProject) - The project to install the package into. - `packageId` (string) - The ID of the package to install. - `resolutionContext` (ResolutionContext) - The context for resolving package dependencies. - `nuGetProjectContext` (INuGetProjectContext) - The context for NuGet project operations. - `primarySourceRepository` (SourceRepository) - The primary package source repository. - `secondarySources` (IEnumerable) - A collection of secondary package sources. - `token` (CancellationToken) - A token to monitor for cancellation requests. ### Returns `Task>` - A task that represents the asynchronous operation, returning a collection of project actions that would be performed. ``` ```APIDOC ## PreviewInstallPackageAsync ### Description Previews the installation of a package by its ID into a NuGet project, using multiple primary source repositories. ### Method `PreviewInstallPackageAsync` ### Parameters - `nuGetProject` (NuGetProject) - The project to install the package into. - `packageId` (string) - The ID of the package to install. - `resolutionContext` (ResolutionContext) - The context for resolving package dependencies. - `nuGetProjectContext` (INuGetProjectContext) - The context for NuGet project operations. - `primarySources` (IEnumerable) - A collection of primary package sources. - `secondarySources` (IEnumerable) - A collection of secondary package sources. - `token` (CancellationToken) - A token to monitor for cancellation requests. ### Returns `Task>` - A task that represents the asynchronous operation, returning a collection of project actions that would be performed. ``` -------------------------------- ### Install NuGet Package using MEF Import Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio/README.md Demonstrates how to import and use the IVsPackageInstaller2 service to install the latest version of a package. Ensure the package is installed and the service is available. ```csharp // Using the Import attribute [Import(typeof(IVsPackageInstaller2))] public IVsPackageInstaller2 packageInstaller; packageInstaller.InstallLatestPackage(source: null, currentProject, "Newtonsoft.Json", includePrerelease: false, ignoreDependencies: false); ``` -------------------------------- ### Preview Projects Install Package Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Provides methods to preview the installation of a package into multiple NuGet projects simultaneously. ```APIDOC ## PreviewProjectsInstallPackageAsync ### Description Previews the installation of a specified package into a collection of NuGet projects. ### Method `PreviewProjectsInstallPackageAsync` ### Parameters - `nuGetProjects` (IReadOnlyCollection) - The collection of projects to install the package into. - `packageIdentity` (PackageIdentity) - The identity of the package to install. - `resolutionContext` (ResolutionContext) - The context for resolving package dependencies. - `nuGetProjectContext` (INuGetProjectContext) - The context for NuGet project operations. - `activeSources` (IReadOnlyCollection) - A collection of active package sources. - `versionRange` (VersionRange) - The version range for the package to install. - `token` (CancellationToken) - A token to monitor for cancellation requests. ### Returns `Task>` - A task that represents the asynchronous operation, returning a collection of resolved actions for each project. ``` ```APIDOC ## PreviewProjectsInstallPackageAsync ### Description Previews the installation of a specified package into a collection of NuGet projects, with options for new mapping ID and source. ### Method `PreviewProjectsInstallPackageAsync` ### Parameters - `nuGetProjects` (IReadOnlyCollection) - The collection of projects to install the package into. - `packageIdentity` (PackageIdentity) - The identity of the package to install. - `resolutionContext` (ResolutionContext) - The context for resolving package dependencies. - `nuGetProjectContext` (INuGetProjectContext) - The context for NuGet project operations. - `activeSources` (IReadOnlyCollection) - A collection of active package sources. - `versionRange` (VersionRange) - The version range for the package to install. - `newMappingID` (string) - The new mapping ID for the package. - `newMappingSource` (string) - The new mapping source for the package. - `token` (CancellationToken) - A token to monitor for cancellation requests. ### Returns `Task>` - A task that represents the asynchronous operation, returning a collection of resolved actions for each project. ``` ```APIDOC ## PreviewProjectsInstallPackageAsync ### Description Previews the installation of a specified package into a collection of NuGet projects, without specifying a version range. ### Method `PreviewProjectsInstallPackageAsync` ### Parameters - `nuGetProjects` (IReadOnlyCollection) - The collection of projects to install the package into. - `packageIdentity` (PackageIdentity) - The identity of the package to install. - `resolutionContext` (ResolutionContext) - The context for resolving package dependencies. - `nuGetProjectContext` (INuGetProjectContext) - The context for NuGet project operations. - `activeSources` (IReadOnlyCollection) - A collection of active package sources. - `token` (CancellationToken) - A token to monitor for cancellation requests. ### Returns `Task>` - A task that represents the asynchronous operation, returning a collection of resolved actions for each project. ``` -------------------------------- ### PreviewInstallPackageAsync Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Previews the installation of a NuGet package into a project. ```APIDOC ## PreviewInstallPackageAsync ### Description Previews the NuGet project actions that would result from installing a package without actually performing the installation. ### Method Signature ```csharp System.Threading.Tasks.Task> PreviewInstallPackageAsync(NuGet.ProjectManagement.NuGetProject nuGetProject, NuGet.Packaging.Core.PackageIdentity packageIdentity, NuGet.PackageManagement.ResolutionContext resolutionContext, NuGet.ProjectManagement.INuGetProjectContext nuGetProjectContext, NuGet.Protocol.Core.Types.SourceRepository primarySourceRepository, System.Collections.Generic.IEnumerable secondarySources, System.Threading.CancellationToken token) ``` ### Parameters * **nuGetProject** (NuGet.ProjectManagement.NuGetProject) - The project to preview the package installation for. * **packageIdentity** (NuGet.Packaging.Core.PackageIdentity) - The identity of the package to preview. * **resolutionContext** (NuGet.PackageManagement.ResolutionContext) - The context for package resolution. * **nuGetProjectContext** (NuGet.ProjectManagement.INuGetProjectContext) - The project context for the preview. * **primarySourceRepository** (NuGet.Protocol.Core.Types.SourceRepository) - The primary source repository to use. * **secondarySources** (System.Collections.Generic.IEnumerable) - Additional source repositories to consider. * **token** (System.Threading.CancellationToken) - The cancellation token for the operation. ### Returns * **System.Threading.Tasks.Task>** - A task that represents the asynchronous operation, returning a collection of NuGet project actions that would be performed. ``` -------------------------------- ### Package Installation Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio/PublicAPI.Shipped.txt Methods for installing NuGet packages into Visual Studio projects. ```APIDOC ## IVsPackageInstaller.InstallPackagesFromVSExtensionRepository ### Description Installs packages from the Visual Studio Extension Repository for a given project. ### Method Signature `void InstallPackagesFromVSExtensionRepository(string extensionId, bool isPreUnzipped, bool skipAssemblyReferences, bool ignoreDependencies, EnvDTE.Project project, System.Collections.Generic.IDictionary packageVersions)` ## IVsPackageInstaller2.InstallLatestPackage ### Description Installs the latest version of a specified NuGet package into a project, with options to include pre-release versions and ignore dependencies. ### Method Signature `void InstallLatestPackage(string source, EnvDTE.Project project, string packageId, bool includePrerelease, bool ignoreDependencies)` ``` -------------------------------- ### InstallationCompatibility Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Gets or sets the installation compatibility checker for the NuGetPackageManager. ```APIDOC ## InstallationCompatibility ### Description Gets or sets the installation compatibility checker used by the NuGetPackageManager. ### Property Signature ```csharp NuGet.PackageManagement.IInstallationCompatibility InstallationCompatibility { get; set; } ``` ``` -------------------------------- ### Example of Using 1ES Official Templates with Multiple Outputs Source: https://github.com/nuget/nuget.client/blob/dev/eng/common/template-guidance.md This example demonstrates how to configure multiple outputs for artifact publishing within an 1ES managed pipeline. Ensure publish artifacts are located in `$(Build.ArtifactStagingDirectory)` to benefit from reduced security scans. ```yaml extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: stages: - stage: build jobs: - template: /eng/common/templates-official/jobs/jobs.yml@self parameters: # 1ES makes use of outputs to reduce security task injection overhead templateContext: outputs: - output: pipelineArtifact displayName: 'Publish logs from source' continueOnError: true condition: always() targetPath: $(Build.ArtifactStagingDirectory)/artifacts/log artifactName: Logs jobs: - job: Windows steps: - script: echo "friendly neighborhood" > artifacts/marvel/spiderman.txt # copy build outputs to artifact staging directory for publishing - task: CopyFiles@2 displayName: Gather build output inputs: SourceFolder: '$(System.DefaultWorkingDirectory)/artifacts/marvel' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/marvel' ``` -------------------------------- ### Get Installed Packages for a Project Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio.Contracts/README.md Retrieve a list of installed packages for a given project using the INuGetProjectService. The service proxy should be disposed after use. ```csharp InstalledPackagesResult installedPackagesResult; using (nugetProjectService as IDisposable) { installedPackagesResult = await nugetProjectService.GetInstalledPackagesAsync(projectGuid, cancellationToken); } ``` -------------------------------- ### NuGet.VisualStudio.IVsPackageInstaller Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio/PublicAPI.Shipped.txt Interface for installing NuGet packages. ```APIDOC ## IVsPackageInstaller ### Description Provides methods for installing NuGet packages into Visual Studio projects. ### Methods - **InstallPackage(IPackageRepository repository, EnvDTE.Project project, string packageId, string version, bool ignoreDependencies, bool skipAssemblyReferences)**: void Installs a package from a specified repository into a project. - **InstallPackage(string source, EnvDTE.Project project, string packageId, Version version, bool ignoreDependencies)**: void Installs a package from a specified source into a project using a Version object. - **InstallPackage(string source, EnvDTE.Project project, string packageId, string version, bool ignoreDependencies)**: void Installs a package from a specified source into a project using a string version. - **InstallPackagesFromRegistryRepository(string keyName, bool isPreUnzipped, bool skipAssemblyReferences, EnvDTE.Project project, IDictionary packageVersions)**: void Installs multiple packages from the Windows Registry repository. - **InstallPackagesFromRegistryRepository(string keyName, bool isPreUnzipped, bool skipAssemblyReferences, bool ignoreDependencies, EnvDTE.Project project, IDictionary packageVersions)**: void Installs multiple packages from the Windows Registry repository with an option to ignore dependencies. - **InstallPackagesFromVSExtensionRepository(string extensionId, bool isPreUnzipped, bool skipAssemblyReferences, EnvDTE.Project project, IDictionary packageVersions)**: void Installs multiple packages from the Visual Studio Extension repository. ``` -------------------------------- ### Package Installer Services Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio/PublicAPI.Shipped.txt Services for querying installed NuGet packages and their status. ```APIDOC ## IVsPackageInstallerServices ### Description Provides services for retrieving information about installed NuGet packages. ### Methods - `GetInstalledPackages()`: Retrieves all installed packages across all projects. - `GetInstalledPackages(EnvDTE.Project project)`: Retrieves packages installed in a specific project. - `IsPackageInstalled(EnvDTE.Project project, string id)`: Checks if a package with the given ID is installed in the project. - `IsPackageInstalled(EnvDTE.Project project, string id, NuGet.SemanticVersion version)`: Checks if a specific version of a package is installed in the project. - `IsPackageInstalledEx(EnvDTE.Project project, string id, string versionString)`: Checks if a package with the given ID and version string is installed in the project. ``` -------------------------------- ### PackageAlreadyInstalledException Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Exception thrown when a package is already installed. ```APIDOC ## PackageAlreadyInstalledException Constructors ### PackageAlreadyInstalledException(string message) Initializes a new instance of the `PackageAlreadyInstalledException` class with a specified error message. ``` -------------------------------- ### InstallPackageAsync (multiple overloads) Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Installs a package into a project using various configurations. ```APIDOC ## InstallPackageAsync ### Description Installs a package into a project using various configurations. ### Method Task ### Parameters - **nuGetProject** (NuGetProject) - The project to install the package into. - **packageIdentity** (PackageIdentity) - The identity of the package to install. - **resolutionContext** (ResolutionContext) - The context for package resolution. - **nuGetProjectContext** (INuGetProjectContext) - The context for the project operations. - **downloadContext** (PackageDownloadContext) - Context for downloading the package. - **primarySourceRepository** (SourceRepository) - The primary source repository to use. - **secondarySources** (IEnumerable) - Additional source repositories to use. - **token** (CancellationToken) - The cancellation token. ``` ```APIDOC ## InstallPackageAsync ### Description Installs a package into a project using various configurations. ### Method Task ### Parameters - **nuGetProject** (NuGetProject) - The project to install the package into. - **packageIdentity** (PackageIdentity) - The identity of the package to install. - **resolutionContext** (ResolutionContext) - The context for package resolution. - **nuGetProjectContext** (INuGetProjectContext) - The context for the project operations. - **downloadContext** (PackageDownloadContext) - Context for downloading the package. - **primarySources** (IEnumerable) - The primary source repositories to use. - **secondarySources** (IEnumerable) - Additional source repositories to use. - **token** (CancellationToken) - The cancellation token. ``` ```APIDOC ## InstallPackageAsync ### Description Installs a package into a project using various configurations. ### Method Task ### Parameters - **nuGetProject** (NuGetProject) - The project to install the package into. - **packageIdentity** (PackageIdentity) - The identity of the package to install. - **resolutionContext** (ResolutionContext) - The context for package resolution. - **nuGetProjectContext** (INuGetProjectContext) - The context for the project operations. - **primarySourceRepository** (SourceRepository) - The primary source repository to use. - **secondarySources** (IEnumerable) - Additional source repositories to use. - **token** (CancellationToken) - The cancellation token. ``` ```APIDOC ## InstallPackageAsync ### Description Installs a package into a project using various configurations. ### Method Task ### Parameters - **nuGetProject** (NuGetProject) - The project to install the package into. - **packageIdentity** (PackageIdentity) - The identity of the package to install. - **resolutionContext** (ResolutionContext) - The context for package resolution. - **nuGetProjectContext** (INuGetProjectContext) - The context for the project operations. - **primarySources** (IEnumerable) - The primary source repositories to use. - **secondarySources** (IEnumerable) - Additional source repositories to use. - **token** (CancellationToken) - The cancellation token. ``` ```APIDOC ## InstallPackageAsync ### Description Installs a package into a project using various configurations. ### Method Task ### Parameters - **nuGetProject** (NuGetProject) - The project to install the package into. - **packageId** (string) - The ID of the package to install. - **resolutionContext** (ResolutionContext) - The context for package resolution. - **nuGetProjectContext** (INuGetProjectContext) - The context for the project operations. - **downloadContext** (PackageDownloadContext) - Context for downloading the package. - **primarySourceRepository** (SourceRepository) - The primary source repository to use. - **secondarySources** (IEnumerable) - Additional source repositories to use. - **token** (CancellationToken) - The cancellation token. ``` ```APIDOC ## InstallPackageAsync ### Description Installs a package into a project using various configurations. ### Method Task ### Parameters - **nuGetProject** (NuGetProject) - The project to install the package into. - **packageId** (string) - The ID of the package to install. - **resolutionContext** (ResolutionContext) - The context for package resolution. - **nuGetProjectContext** (INuGetProjectContext) - The context for the project operations. - **downloadContext** (PackageDownloadContext) - Context for downloading the package. - **primarySources** (IEnumerable) - The primary source repositories to use. - **secondarySources** (IEnumerable) - Additional source repositories to use. - **token** (CancellationToken) - The cancellation token. ``` -------------------------------- ### Get All Target Frameworks Source: https://github.com/nuget/nuget.client/blob/dev/docs/updating-target-frameworks.md Use this target to list all target frameworks for verification. Run from the repository root. ```batch msbuild .\build\build.proj /t:GetAllTargetFrameworks /v:m /restore:false ``` ```batch msbuild .\build\build.proj /t:GetAllTargetFrameworks /v:m /restore:false /p:DotNetBuildSourceOnly="true" ``` -------------------------------- ### NuGetPackageManager Static Methods Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Methods for managing package installations directly. ```APIDOC ## SetDirectInstall ### Description Sets a package as a direct install for the project. ### Method static ### Signature NuGet.PackageManagement.NuGetPackageManager.SetDirectInstall(NuGet.Packaging.Core.PackageIdentity directInstall, NuGet.ProjectManagement.INuGetProjectContext nuGetProjectContext) -> void ``` -------------------------------- ### BuildIntegratedInstallationContext Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Context for build-integrated package installation, managing successful and unsuccessful frameworks, and include types. ```APIDOC ## BuildIntegratedInstallationContext ### Description Provides context for package installation operations integrated with the build process. It tracks framework successes and failures, and manages package inclusion flags. ### Methods #### Constructor - `BuildIntegratedInstallationContext()`: Initializes a new instance of the `BuildIntegratedInstallationContext` class. #### Properties - `AreAllPackagesConditional` (bool): Gets a value indicating whether all packages are conditional. - `IncludeType` (NuGet.LibraryModel.LibraryIncludeFlags): Gets or sets the include type flags for packages. - `SuccessfulFrameworks` (System.Collections.Generic.List): Gets or initializes the list of successfully targeted frameworks. - `SuppressParent` (NuGet.LibraryModel.LibraryIncludeFlags): Gets or sets the suppress parent flags. - `UnsuccessfulFrameworks` (System.Collections.Generic.List): Gets or initializes the list of unsuccessfully targeted frameworks. ``` -------------------------------- ### NuGetProjectAction Static Methods Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Methods for creating project actions related to package installation and uninstallation. ```APIDOC ## CreateInstallProjectAction ### Description Creates a project action to install a specified package. ### Method static ### Signature NuGet.PackageManagement.NuGetProjectAction.CreateInstallProjectAction(NuGet.Packaging.Core.PackageIdentity packageIdentity, NuGet.Protocol.Core.Types.SourceRepository sourceRepository, NuGet.ProjectManagement.NuGetProject project) -> NuGet.PackageManagement.NuGetProjectAction ## CreateInstallProjectAction ### Description Creates a project action to install a specified package with a version range. ### Method static ### Signature NuGet.PackageManagement.NuGetProjectAction.CreateInstallProjectAction(NuGet.Packaging.Core.PackageIdentity packageIdentity, NuGet.Protocol.Core.Types.SourceRepository sourceRepository, NuGet.ProjectManagement.NuGetProject project, NuGet.Versioning.VersionRange versionRange) -> NuGet.PackageManagement.NuGetProjectAction ## CreateUninstallProjectAction ### Description Creates a project action to uninstall a specified package. ### Method static ### Signature NuGet.PackageManagement.NuGetProjectAction.CreateUninstallProjectAction(NuGet.Packaging.Core.PackageIdentity packageIdentity, NuGet.ProjectManagement.NuGetProject project) -> NuGet.PackageManagement.NuGetProjectAction ``` -------------------------------- ### InstallPackageAsync Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Installs a NuGet package into a project. Overloads exist for specifying primary and secondary source repositories. ```APIDOC ## InstallPackageAsync ### Description Installs a NuGet package into the specified project. ### Method Signature ```csharp System.Threading.Tasks.Task InstallPackageAsync(NuGet.ProjectManagement.NuGetProject nuGetProject, string packageId, NuGet.PackageManagement.ResolutionContext resolutionContext, NuGet.ProjectManagement.INuGetProjectContext nuGetProjectContext, NuGet.Protocol.Core.Types.SourceRepository primarySourceRepository, System.Collections.Generic.IEnumerable secondarySources, System.Threading.CancellationToken token) ``` ### Parameters * **nuGetProject** (NuGet.ProjectManagement.NuGetProject) - The project to install the package into. * **packageId** (string) - The ID of the package to install. * **resolutionContext** (NuGet.PackageManagement.ResolutionContext) - The context for package resolution. * **nuGetProjectContext** (NuGet.ProjectManagement.INuGetProjectContext) - The project context for the installation. * **primarySourceRepository** (NuGet.Protocol.Core.Types.SourceRepository) - The primary source repository to use. * **secondarySources** (System.Collections.Generic.IEnumerable) - Additional source repositories to consider. * **token** (System.Threading.CancellationToken) - The cancellation token for the operation. ``` ```APIDOC ## InstallPackageAsync (with primary sources) ### Description Installs a NuGet package into the specified project, allowing multiple primary sources. ### Method Signature ```csharp System.Threading.Tasks.Task InstallPackageAsync(NuGet.ProjectManagement.NuGetProject nuGetProject, string packageId, NuGet.PackageManagement.ResolutionContext resolutionContext, NuGet.ProjectManagement.INuGetProjectContext nuGetProjectContext, System.Collections.Generic.IEnumerable primarySources, System.Collections.Generic.IEnumerable secondarySources, System.Threading.CancellationToken token) ``` ### Parameters * **nuGetProject** (NuGet.ProjectManagement.NuGetProject) - The project to install the package into. * **packageId** (string) - The ID of the package to install. * **resolutionContext** (NuGet.PackageManagement.ResolutionContext) - The context for package resolution. * **nuGetProjectContext** (NuGet.ProjectManagement.INuGetProjectContext) - The project context for the installation. * **primarySources** (System.Collections.Generic.IEnumerable) - The primary source repositories to use. * **secondarySources** (System.Collections.Generic.IEnumerable) - Additional source repositories to consider. * **token** (System.Threading.CancellationToken) - The cancellation token for the operation. ``` -------------------------------- ### Initialize Package Sources and Repositories Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/README.md Demonstrates how to create PackageSource objects for local or remote NuGet feeds and obtain SourceRepository instances for interacting with them. Use Repository.Factory.GetCoreV3 for V3 protocol endpoints. ```csharp PackageSource localSource = new PackageSource(@"D:\\LocalSource"); SourceRepository localRepository = Repository.Factory.GetCoreV3(localSource); SourceRepository repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json"); ``` -------------------------------- ### Clone and Set Up Remote Repositories Source: https://github.com/nuget/nuget.client/blob/dev/CONTRIBUTING.md Clone the NuGet.Client repository and set up the 'upstream' remote for the official repository. This is a one-time setup after forking. ```console \> git clone https://github.com/[user-name]/NuGet.Client \> cd NuGet.Client \NuGet.Client> git remote add upstream https://github.com/NuGet/NuGet.Client \NuGet.Client> git remote set-url --push upstream no_push ``` -------------------------------- ### PluginCredentialProvider.Execute Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Credentials/PublicAPI/net472/PublicAPI.Shipped.txt Executes the credential provider with the given process start information and cancellation token. Captures standard output. ```APIDOC ## virtual NuGet.Credentials.PluginCredentialProvider.Execute ### Description Executes the credential provider with the given process start information and cancellation token. Captures standard output. ### Signature int Execute(System.Diagnostics.ProcessStartInfo startInfo, System.Threading.CancellationToken cancellationToken, out string stdOut) ``` -------------------------------- ### NuGet.Commands.IClientCertArgsWithConfigFile Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Commands/PublicAPI/net8.0/PublicAPI.Shipped.txt Interface for arguments that include a configuration file path for client certificates. ```APIDOC ## Interface NuGet.Commands.IClientCertArgsWithConfigFile ### Properties - **Configfile**: `string` - Gets or sets the path to the NuGet configuration file. ``` -------------------------------- ### Get NuGet Resource Async Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/README.md Shows how to asynchronously retrieve an implementation of an INuGetResource from a SourceRepository. This is typically used to get specific V3 resource implementations like FindPackageByIdResource. ```csharp FindPackageByIdResource resource = await repository.GetResourceAsync(); ``` -------------------------------- ### NuGet.Commands.IClientCertArgsWithConfigFile Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Commands/PublicAPI/net472/PublicAPI.Shipped.txt Interface for arguments that include a configuration file path for client certificate operations. ```APIDOC ## Interface: NuGet.Commands.IClientCertArgsWithConfigFile ### Description Represents arguments that require a NuGet configuration file path for operations involving client certificates. ### Properties - **Configfile** (string) - Gets or sets the path to the NuGet configuration file. ``` -------------------------------- ### Run NuGet Benchmarks Source: https://github.com/nuget/nuget.client/blob/dev/test/TestExtensions/NuGet.Benchmarks/README.md Execute micro-benchmarks using the dotnet CLI. Ensure you run in Release configuration for accurate results. ```bash dotnet run -c Release --project test/TestExtensions/NuGet.Benchmarks/NuGet.Benchmarks.csproj ``` -------------------------------- ### InstallationCompatibility Methods Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Methods for ensuring package compatibility within a project context. ```APIDOC ## EnsurePackageCompatibility ### Description Ensures that the specified NuGet project actions are compatible with the project and its current state. ### Method `void EnsurePackageCompatibility(NuGetProject nuGetProject, INuGetPathContext pathContext, IEnumerable nuGetProjectActions, RestoreResult restoreResult)` ### Endpoint N/A (SDK Method) ### Parameters - **nuGetProject** (NuGetProject) - The project to check compatibility for. - **pathContext** (INuGetPathContext) - The path context for resolving paths. - **nuGetProjectActions** (IEnumerable) - The actions to check for compatibility. - **restoreResult** (RestoreResult) - The result of the restore operation. ### Response None (void) ``` ```APIDOC ## EnsurePackageCompatibilityAsync ### Description Asynchronously ensures that a package is compatible with the project, considering its identity and download results. ### Method `Task EnsurePackageCompatibilityAsync(NuGetProject nuGetProject, PackageIdentity packageIdentity, DownloadResourceResult resourceResult, CancellationToken cancellationToken)` ### Endpoint N/A (SDK Method) ### Parameters - **nuGetProject** (NuGetProject) - The project to check compatibility for. - **packageIdentity** (PackageIdentity) - The identity of the package to check. - **resourceResult** (DownloadResourceResult) - The result of the package download operation. - **cancellationToken** (CancellationToken) - A token to observe for cancellation requests. ### Response #### Success Response (Task) Returns a task that represents the asynchronous operation. ``` -------------------------------- ### LocalV3FindPackageByIdResourceProvider Constructor Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Shipped.txt Initializes a new instance of the `LocalV3FindPackageByIdResourceProvider` class. ```APIDOC ## LocalV3FindPackageByIdResourceProvider Constructor ### Description Initializes a new instance of the `LocalV3FindPackageByIdResourceProvider` class. ### Method `LocalV3FindPackageByIdResourceProvider()` ``` -------------------------------- ### LocalV3FindPackageByIdResource Constructor Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Shipped.txt Initializes a new instance of the `LocalV3FindPackageByIdResource` class. ```APIDOC ## LocalV3FindPackageByIdResource Constructor ### Description Initializes a new instance of the `LocalV3FindPackageByIdResource` class. ### Method `LocalV3FindPackageByIdResource(NuGet.Configuration.PackageSource packageSource)` ### Parameters #### Path Parameters - **packageSource** (NuGet.Configuration.PackageSource) - The package source to use. ``` -------------------------------- ### GetInstalledPackagesInDependencyOrder Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Retrieves installed packages in dependency order. ```APIDOC ## GetInstalledPackagesInDependencyOrder ### Description Retrieves installed packages in dependency order. ### Method Task> ### Parameters - **nuGetProject** (NuGetProject) - The project to query. - **token** (CancellationToken) - The cancellation token. ``` -------------------------------- ### Package Metadata Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio/PublicAPI.Shipped.txt Information about installed NuGet packages. ```APIDOC ## IVsPackageMetadata ### Description Represents metadata for an installed NuGet package. ### Properties - `Authors` (IEnumerable): The authors of the package. - `Description` (string): A description of the package. - `Id` (string): The unique identifier of the package. - `InstallPath` (string): The installation path of the package on the local file system. - `Title` (string): The title of the package. - `Version` (NuGet.SemanticVersion): The semantic version of the package. - `VersionString` (string): The version of the package as a string. ``` -------------------------------- ### RepositoryCountersignature Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Packaging/PublicAPI/net472/PublicAPI.Shipped.txt Provides methods to get repository countersignatures. ```APIDOC ## RepositoryCountersignature ### Description Provides methods to get repository countersignatures. ### Methods - `GetRepositoryCountersignature(PrimarySignature primarySignature)`: Gets the repository countersignature for a given primary signature. ``` -------------------------------- ### LocalV2FindPackageByIdResourceProvider Constructor Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Shipped.txt Initializes a new instance of the `LocalV2FindPackageByIdResourceProvider` class. ```APIDOC ## LocalV2FindPackageByIdResourceProvider Constructor ### Description Initializes a new instance of the `LocalV2FindPackageByIdResourceProvider` class. ### Method `LocalV2FindPackageByIdResourceProvider()` ``` -------------------------------- ### NuGet.Packaging.Licenses.NuGetLicenseData LicenseListVersion Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Packaging/PublicAPI/net472/PublicAPI.Shipped.txt Gets the version of the license list. ```APIDOC ## NuGet.Packaging.Licenses.NuGetLicenseData ### Description Provides information about NuGet license data. ### Properties - `static string! LicenseListVersion.get`: Gets the current version of the license list. ``` -------------------------------- ### LocalV2FindPackageByIdResource Constructor Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Shipped.txt Initializes a new instance of the `LocalV2FindPackageByIdResource` class. ```APIDOC ## LocalV2FindPackageByIdResource Constructor ### Description Initializes a new instance of the `LocalV2FindPackageByIdResource` class. ### Method `LocalV2FindPackageByIdResource(NuGet.Configuration.PackageSource packageSource)` ### Parameters #### Path Parameters - **packageSource** (NuGet.Configuration.PackageSource) - The package source to use. ``` -------------------------------- ### NuGet.Packaging.FrameworksExtensions GetFrameworkString Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Packaging/PublicAPI/net472/PublicAPI.Shipped.txt Gets the string representation of a NuGetFramework. ```APIDOC ## NuGet.Packaging.FrameworksExtensions ### Description Provides extension methods for NuGetFramework objects. ### Methods - `static string! GetFrameworkString(this NuGet.Frameworks.NuGetFramework! self)`: Returns the string representation of the NuGetFramework. ``` -------------------------------- ### NuGet.Commands.IClientCertArgsWithStoreData Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Commands/PublicAPI/net472/PublicAPI.Shipped.txt Interface for arguments related to client certificate store data. ```APIDOC ## Interface: NuGet.Commands.IClientCertArgsWithStoreData ### Description Defines properties for specifying how to find and access client certificates within the certificate store. ### Properties - **FindBy** (string) - Gets or sets the criteria for finding the certificate (e.g., SubjectName, Thumbprint). - **FindValue** (string) - Gets or sets the value to search for based on the `FindBy` criteria. - **StoreLocation** (string) - Gets or sets the location of the certificate store (e.g., CurrentUser, LocalMachine). - **StoreName** (string) - Gets or sets the name of the certificate store (e.g., My, Root). ``` -------------------------------- ### PackagesFolderSourceRepository Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Gets or sets the SourceRepository for the packages folder. ```APIDOC ## PackagesFolderSourceRepository ### Description Gets or sets the SourceRepository associated with the packages folder. ### Property Signature ```csharp NuGet.Protocol.Core.Types.SourceRepository PackagesFolderSourceRepository { get; set; } ``` ``` -------------------------------- ### PackagesFolderNuGetProject Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Gets or sets the FolderNuGetProject associated with the NuGetPackageManager. ```APIDOC ## PackagesFolderNuGetProject ### Description Gets or sets the FolderNuGetProject representing the packages folder. ### Property Signature ```csharp NuGet.ProjectManagement.FolderNuGetProject PackagesFolderNuGetProject { get; set; } ``` ``` -------------------------------- ### X509 Trust Store Methods Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Packaging/PublicAPI/net472/PublicAPI.Shipped.txt Methods for initializing the X.509 trust store. ```APIDOC ## InitializeForDotNetSdk ### Description Initializes the X.509 trust store for the .NET SDK. ### Method static ### Signature `NuGet.Packaging.Signing.X509TrustStore.InitializeForDotNetSdk(NuGet.Common.ILogger logger)` ### Returns `void` ``` -------------------------------- ### FindLocalPackagesResource.GetPackages Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net8.0/PublicAPI.Shipped.txt Retrieves information for all local packages installed on the machine. ```APIDOC ## GetPackages ### Description Retrieves information for all local packages currently installed on the machine. ### Method `GetPackages` ### Parameters - `logger` (ILogger) - Logger for diagnostic messages. - `token` (CancellationToken) - Token for cancellation. ### Returns `IEnumerable` - An enumerable collection of local package information. ``` -------------------------------- ### GetInstalledPackagesDependencyInfo Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PublicAPI.Shipped.txt Retrieves dependency information for installed packages in a project. ```APIDOC ## GetInstalledPackagesDependencyInfo ### Description Retrieves dependency information for installed packages in a project. ### Method Task> ### Parameters - **nuGetProject** (NuGetProject) - The project to query. - **token** (CancellationToken) - The cancellation token. - **includeUnresolved** (bool) - Whether to include unresolved dependencies. Defaults to false. ``` -------------------------------- ### Program Static Method Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.CommandLine.XPlat/PublicAPI.Shipped.txt The main entry point for the NuGet.CommandLine.XPlat application. ```APIDOC ## NuGet.CommandLine.XPlat.Program ### Description The main entry point for the NuGet.CommandLine.XPlat application. ### Methods #### Static Methods - **Run**(string[] args, NuGet.CommandLine.XPlat.IVirtualProjectBuilder virtualProjectBuilder) -> int - Runs the NuGet.CommandLine.XPlat application with the specified arguments and virtual project builder. ``` -------------------------------- ### NuGetInstalledPackage Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio.Contracts/PublicAPI.Shipped.txt Represents a single installed NuGet package with its details. ```APIDOC ## NuGetInstalledPackage ### Properties - **Id** (string) - The unique identifier of the package. - **RequestedRange** (string) - The version range that was requested for the package. - **Version** (string) - The installed version of the package. - **InstallPath** (string) - The local path where the package is installed. - **DirectDependency** (bool) - Indicates if the package is a direct dependency. ``` -------------------------------- ### Provider TryCreate Methods Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Shipped.txt Methods for attempting to create NuGet resources from a source repository. ```APIDOC ## TryCreate (MetadataResourceV2FeedProvider) ### Description Attempts to create a `MetadataResourceV2Feed` from a given source repository. ### Method `TryCreate` ### Parameters - `source` (SourceRepository) - The source repository to create the resource from. - `token` (CancellationToken) - The cancellation token. ### Returns `Task>` - A task that represents the asynchronous operation. The first element of the tuple indicates success, and the second is the created `INuGetResource` if successful. ``` ```APIDOC ## TryCreate (MetadataResourceV3Provider) ### Description Attempts to create a `MetadataResourceV3` from a given source repository. ### Method `TryCreate` ### Parameters - `source` (SourceRepository) - The source repository to create the resource from. - `token` (CancellationToken) - The cancellation token. ### Returns `Task>` - A task that represents the asynchronous operation. The first element of the tuple indicates success, and the second is the created `INuGetResource` if successful. ``` ```APIDOC ## TryCreate (ODataServiceDocumentResourceV2Provider) ### Description Attempts to create an `ODataServiceDocumentResourceV2` from a given source repository. ### Method `TryCreate` ### Parameters - `source` (SourceRepository) - The source repository to create the resource from. - `token` (CancellationToken) - The cancellation token. ### Returns `Task>` - A task that represents the asynchronous operation. The first element of the tuple indicates success, and the second is the created `INuGetResource` if successful. ``` ```APIDOC ## TryCreate (PackageDetailsUriResourceV3Provider) ### Description Attempts to create a `PackageDetailsUriResourceV3` from a given source repository. ### Method `TryCreate` ### Parameters - `source` (SourceRepository) - The source repository to create the resource from. - `token` (CancellationToken) - The cancellation token. ### Returns `Task>` - A task that represents the asynchronous operation. The first element of the tuple indicates success, and the second is the created `INuGetResource` if successful. ``` ```APIDOC ## TryCreate (PackageMetadataResourceV2FeedProvider) ### Description Attempts to create a `PackageMetadataResourceV2Feed` from a given source repository. ### Method `TryCreate` ### Parameters - `source` (SourceRepository) - The source repository to create the resource from. - `token` (CancellationToken) - The cancellation token. ### Returns `Task>` - A task that represents the asynchronous operation. The first element of the tuple indicates success, and the second is the created `INuGetResource` if successful. ``` -------------------------------- ### NuGet.Packaging.ManifestVersionUtility GetManifestVersion Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Packaging/PublicAPI/net472/PublicAPI.Shipped.txt Gets the manifest version from package metadata. ```APIDOC ## NuGet.Packaging.ManifestVersionUtility ### Description Provides utility methods for handling manifest versions. ### Methods - `static int GetManifestVersion(NuGet.Packaging.ManifestMetadata! metadata)`: Retrieves the manifest version from the provided metadata. ``` -------------------------------- ### MetadataResourceV3Provider Constructor Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Shipped.txt Initializes a new instance of the `MetadataResourceV3Provider` class. ```APIDOC ## MetadataResourceV3Provider Constructor ### Description Initializes a new instance of the `MetadataResourceV3Provider` class. ### Method `MetadataResourceV3Provider()` ``` -------------------------------- ### Build NuGet.Client Project Source: https://github.com/nuget/nuget.client/blob/dev/CONTRIBUTING.md Execute this PowerShell script to build the NuGet.Client project. Use the -RunUnitTests switch to also run unit tests. ```powershell .\build.ps1 ``` ```powershell .\build.ps1 -RunUnitTests ``` -------------------------------- ### SignatureType Property Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Packaging/PublicAPI/net472/PublicAPI.Shipped.txt Gets the type of signature for a signing request. ```APIDOC ## SignPackageRequest.SignatureType ### Property - **get** - Description: Gets the type of the signature. - Returns: SignatureType ``` -------------------------------- ### LocalRepositories.LocalPackageListResourceProvider Methods Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Protocol/PublicAPI/net8.0/PublicAPI.Shipped.txt Provides methods for creating instances of LocalPackageListResource. ```APIDOC ## TryCreate ### Description Attempts to create a LocalPackageListResource from a source repository. ### Method `TryCreate` ### Parameters - `source` (SourceRepository) - The source repository to create the resource from. - `token` (CancellationToken) - Token for cancellation. ### Returns `Task>` - A tuple indicating success and the created resource if successful. ``` -------------------------------- ### AssetTargetFallbackUtility.GetFallbackFramework Source: https://github.com/nuget/nuget.client/blob/dev/src/NuGet.Core/NuGet.Commands/PublicAPI/net8.0/PublicAPI.Shipped.txt Gets the fallback framework for a given project framework. ```APIDOC ## GetFallbackFramework AssetTargetFallbackUtility ### Description Gets the fallback framework for a given project framework. ### Method `static NuGetFramework GetFallbackFramework(NuGetFramework projectFramework, IEnumerable packageTargetFallback, IEnumerable assetTargetFallback)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp // Example usage: var projectFramework = new NuGetFramework("net8.0"); var packageFallback = new List(); var assetFallback = new List(); var fallback = AssetTargetFallbackUtility.GetFallbackFramework(projectFramework, packageFallback, assetFallback); ``` ### Response #### Success Response (200) - **NuGetFramework**: The determined fallback framework. ```