public static InstallPackagesAsync ( string>.Dictionary |
||
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);
}
}
NuGetUtilities::InstallPackagesAsync ( Project targetProject, string>.Dictionary |
/// <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); } }