public async Task <bool> RunAsync() { var folderProject = new FolderNuGetProject(_defaultProject.ContentPath); if (!_directoryService.Exists(_defaultProject.ContentPath)) { Log.Info($"Plugins folder does not exist"); return(false); } var subFolders = folderProject.GetPackageDirectories(); var failedIdentities = new List <PackageIdentity>(); var parsedPackages = new List <IPackageDetails>(); bool anyUpgraded = false; using (var context = AcquireSourceContextForActions()) { if (context == SourceContext.EmptyContext) { Log.Warning($"Source context is empty"); return(false); } foreach (var folder in subFolders) { var packageFolderName = Path.GetFileName(folder); var package = PackageIdentityParser.Parse(packageFolderName); var packageDetails = PackageDetailsFactory.Create(package); parsedPackages.Add(packageDetails); } //no valid package folders if (!parsedPackages.Any()) { return(false); } _packageOperationNotificationService.NotifyAutomaticOperationBatchStarting(PackageOperationType.Install, parsedPackages.ToArray()); foreach (var packageDetails in parsedPackages) { var package = packageDetails.GetIdentity(); if (package is null) { continue; } var installationPath = _defaultProject.GetInstallPath(package); var isV2packageInstalled = folderProject.PackageExists(package, NuGet.Packaging.PackageSaveMode.Defaultv2); if (!isV2packageInstalled) { Log.Warning($"Package '{package}' is recognized in project folder as v2 NuGet installed package"); continue; } if (await _nuGetPackageManager.IsPackageInstalledAsync(_defaultProject, package, default)) { Log.Info($"Skipping package '{package}', package is valid"); continue; } _packageOperationNotificationService.NotifyAutomaticOperationStarting(installationPath, PackageOperationType.Install, packageDetails); //reinstall try { var isInstalled = await _nuGetPackageManager.InstallPackageForProjectAsync(_defaultProject, package, default, false);
public override object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData) { return(PackageIdentityParser.Parse(text)); }