public override void ExecuteCommand() { if (Self) { var selfUpdater = new SelfUpdater(RepositoryFactory) { Console = Console }; selfUpdater.UpdateSelf(); } else { string inputFile = GetInputFile(); if (String.IsNullOrEmpty(inputFile)) { throw new CommandLineException(NuGetResources.InvalidFile); } else if (inputFile.EndsWith(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) { UpdatePackages(inputFile); } else { if (!FileSystem.FileExists(inputFile)) { throw new CommandLineException(NuGetResources.UnableToFindSolution, inputFile); } else { string solutionDir = Path.GetDirectoryName(inputFile); UpdateAllPackages(solutionDir); } } } }
public override void ExecuteCommand() { // update with self as parameter if (Self) { var selfUpdater = new SelfUpdater(RepositoryFactory) { Console = Console, IncludePrerelease = Prerelease }; selfUpdater.UpdateSelf(); return; } string inputFile = GetInputFile(); if (string.IsNullOrEmpty(inputFile)) { throw new CommandLineException(NuGetResources.InvalidFile); } string inputFileName = Path.GetFileName(inputFile); // update with packages.config as parameter if (PackageReferenceFile.IsValidConfigFileName(inputFileName)) { UpdatePackages(inputFile); return; } // update with project file as parameter if (ProjectHelper.SupportedProjectExtensions.Contains(Path.GetExtension(inputFile) ?? string.Empty)) { if (!FileSystem.FileExists(inputFile)) { throw new CommandLineException(NuGetResources.UnableToFindProject, inputFile); } UpdatePackages(new MSBuildProjectSystem(inputFile)); return; } if (!FileSystem.FileExists(inputFile)) { throw new CommandLineException(NuGetResources.UnableToFindSolution, inputFile); } // update with solution as parameter string solutionDir = Path.GetDirectoryName(inputFile); UpdateAllPackages(solutionDir); }