public override async Task ExecuteCommandAsync() { // update with self as parameter if (Self) { var selfUpdater = new SelfUpdater(repositoryFactory: RepositoryFactory) { Console = Console }; selfUpdater.UpdateSelf(Prerelease); return; } string inputFile = GetInputFile(); if (string.IsNullOrEmpty(inputFile)) { throw new CommandLineException(NuGetResources.InvalidFile); } _msbuildDirectory = MsBuildUtility.GetMsBuildDirectoryFromMsBuildPath(MSBuildPath, MSBuildVersion, Console).Value.Path; var context = new UpdateConsoleProjectContext(Console, FileConflictAction); string inputFileName = Path.GetFileName(inputFile); // update with packages.config as parameter if (CommandLineUtility.IsValidConfigFileName(inputFileName)) { await UpdatePackagesAsync(inputFile, context); return; } // update with project file as parameter if (ProjectHelper.SupportedProjectExtensions.Contains(Path.GetExtension(inputFile) ?? string.Empty)) { if (!File.Exists(inputFile)) { throw new CommandLineException(NuGetResources.UnableToFindProject, inputFile); } var projectSystem = new MSBuildProjectSystem( _msbuildDirectory, inputFile, context); await UpdatePackagesAsync(projectSystem, GetRepositoryPath(projectSystem.ProjectFullPath)); return; } if (!File.Exists(inputFile)) { throw new CommandLineException(NuGetResources.UnableToFindSolution, inputFile); } // update with solution as parameter string solutionDir = Path.GetDirectoryName(inputFile); await UpdateAllPackages(solutionDir, context); }
public override async Task ExecuteCommandAsync() { // update with self as parameter if (Self) { var selfUpdater = new SelfUpdater(repositoryFactory: RepositoryFactory) { Console = Console }; selfUpdater.UpdateSelf(Prerelease); return; } string inputFile = GetInputFile(); if (string.IsNullOrEmpty(inputFile)) { throw new CommandLineException(NuGetResources.InvalidFile); } _msbuildDirectory = MsBuildUtility.GetMsBuildDirectoryFromMsBuildPath(MSBuildPath, MSBuildVersion, Console).Value.Path; var context = new UpdateConsoleProjectContext(Console, FileConflictAction); var logger = new LoggerAdapter(context); var signedPackageVerifier = new PackageSignatureVerifier(SignatureVerificationProviderFactory.GetSignatureVerificationProviders()); var signedPackageVerifierSettings = SignedPackageVerifierSettings.GetClientPolicy(Settings, logger); context.PackageExtractionContext = new PackageExtractionContext( PackageSaveMode.Defaultv2, PackageExtractionBehavior.XmlDocFileSaveMode, logger, signedPackageVerifier, signedPackageVerifierSettings); string inputFileName = Path.GetFileName(inputFile); // update with packages.config as parameter if (CommandLineUtility.IsValidConfigFileName(inputFileName)) { await UpdatePackagesAsync(inputFile, context); return; } // update with project file as parameter if (ProjectHelper.SupportedProjectExtensions.Contains(Path.GetExtension(inputFile) ?? string.Empty)) { if (!File.Exists(inputFile)) { throw new CommandLineException(NuGetResources.UnableToFindProject, inputFile); } var projectSystem = new MSBuildProjectSystem( _msbuildDirectory, inputFile, context); await UpdatePackagesAsync(projectSystem, GetRepositoryPath(projectSystem.ProjectFullPath)); return; } if (!File.Exists(inputFile)) { throw new CommandLineException(NuGetResources.UnableToFindSolution, inputFile); } // update with solution as parameter string solutionDir = Path.GetDirectoryName(inputFile); await UpdateAllPackages(solutionDir, context); }