AzureIoTHubConnectedService.NuGetUtilities.InstallPackagesAsync C# (CSharp) Method

InstallPackagesAsync() public static method

Ensures the appropriate version of the specified packages are installed. If an existing version of the package already exists the following will happen: If a semantically compatible version already exists, no change is made to the package. If an older major version exists, a warning is logged and the package is upgraded. If an older minor/build version exists, an information message is logged and the package is upgraded. If a newer major version exists, a warning is logged and no change is made to the package.
public static InstallPackagesAsync ( string>.Dictionary packages, string extensionId, ConnectedServiceLogger logger, Project project, IVsPackageInstallerServices packageInstallerServices, IVsPackageInstaller packageInstaller ) : System.Threading.Tasks.Task
packages string>.Dictionary
extensionId string
logger ConnectedServiceLogger
project Project
packageInstallerServices IVsPackageInstallerServices
packageInstaller IVsPackageInstaller
return System.Threading.Tasks.Task
        public static async Task InstallPackagesAsync(
            Dictionary<string, string> packages,
            string extensionId,
            ConnectedServiceLogger logger,
            Project project,
            IVsPackageInstallerServices packageInstallerServices,
            IVsPackageInstaller packageInstaller)
        {
            Dictionary<string, string> packagesToInstall = new Dictionary<string, string>();

            await NuGetUtilities.InstallPackagesAsync(
                project,
                packages,
                (packageId, packageVersion) =>
                {
                    packagesToInstall.Add(packageId, packageVersion);
                    return Task.FromResult<object>(null);
                },
                logger,
                packageInstallerServices);

            if (packagesToInstall.Any())
            {
                packageInstaller.InstallPackagesFromVSExtensionRepository(extensionId, false, false, project, packagesToInstall);
            }
        }

Same methods

NuGetUtilities::InstallPackagesAsync ( Project targetProject, string>.Dictionary packages, Func installPackage, ConnectedServiceLogger logger, IVsPackageInstallerServices packageInstallerServices ) : System.Threading.Tasks.Task

Usage Example

コード例 #1
0
        /// <summary>
        /// Ensures the appropriate version of the specified packages are installed.  If an existing version of the package
        /// already exists the following will happen:
        /// If a semantically compatible version already exists, no change is made to the package.
        /// If an older major version exists, a warning is logged and the package is upgraded.
        /// If an older minor/build version exists, an information message is logged and the package is upgraded.
        /// If a newer major version exists, a warning is logged and no change is made to the package.
        /// </summary>
        public static async Task InstallPackagesAsync(
            Dictionary <string, string> packages,
            string extensionId,
            ConnectedServiceLogger logger,
            Project project,
            IVsPackageInstallerServices packageInstallerServices,
            IVsPackageInstaller packageInstaller)
        {
            Dictionary <string, string> packagesToInstall = new Dictionary <string, string>();

            await NuGetUtilities.InstallPackagesAsync(
                project,
                packages,
                (packageId, packageVersion) =>
            {
                packagesToInstall.Add(packageId, packageVersion);
                return(Task.FromResult <object>(null));
            },
                logger,
                packageInstallerServices);

            if (packagesToInstall.Any())
            {
                packageInstaller.InstallPackagesFromVSExtensionRepository(extensionId, false, false, project, packagesToInstall);
            }
        }
All Usage Examples Of AzureIoTHubConnectedService.NuGetUtilities::InstallPackagesAsync