static void Execute(string basePath, SearchQueryFilter filter, string?setVersion, string outputFile, string outputFileFormatStr) { var tools = new ProjectNugetVersionUpdater(new DotNetPackageReferenceUpdater()); var projFileService = new ProjectFileService(); OutputFileFormat outputFormat = !string.IsNullOrEmpty(outputFileFormatStr) ? Enum.Parse <OutputFileFormat>(outputFileFormatStr, true) : OutputFileFormat.Default; IProjectFileResultsRenderer projectFileRenderer; basePath = Path.GetFullPath(basePath); var projFiles = projFileService.GetProjectFilesByFilter(basePath, filter); if (!string.IsNullOrEmpty(outputFile)) { var outputFilePath = Path.GetFullPath(outputFile); Console.Write($"Writing output to {outputFilePath}"); if (!string.IsNullOrEmpty(outputFileFormatStr)) { Console.Write($" format: {outputFileFormatStr}"); } Console.WriteLine(); // no format so just redirect FileOutput.RedirectConsoleToFile(outputFilePath); } switch (outputFormat) { case OutputFileFormat.Json: projectFileRenderer = new ProjectFileJsonRenderer(); break; default: projectFileRenderer = new ProjectFileConsoleRenderer(); break; } projectFileRenderer.RenderResults(basePath, filter, projFiles); if (!string.IsNullOrEmpty(setVersion)) { var startTabPad = 10; var strPad = new string(' ', startTabPad); if (projFileService.SetNugetPackageVersions(filter, setVersion, projFiles, strPad, tools)) { return; } } }