protected override void Parse() { GenLog.Debug($"Parsing for NuGet packages in {PackagesConfigFile}"); var xelement = GetParsedXml(PackagesConfigFile); var packages = xelement.Descendants("package"); foreach (var packageElement in packages) { var id = packageElement.Attribute("id")?.Value; var versionRaw = packageElement.Attribute("version")?.Value; if (id == null || versionRaw == null) { throw new Exception($"Invalid syntax in {PackagesConfigFile}"); } var result = Statics.GetPackageDefinition(id, versionRaw); if (result == null) { continue; } GenLog.Debug($"Found {result}"); Packages.Add(result); } }
public static IInteractionHandler GetHandler(IInteractivityOptions options) { if (options.Pause) { GenLog.Debug("Using TemporaryConsoleInteractionHandler"); return(new TemporaryConsoleInteractionHandler(options)); } GenLog.Debug("Using ConsoleInteractionHandler"); return(new ConsoleInteractionHandler(options)); }
public static async Task <(int exitCode, string stdout, string stderr)> RunSilent(string program, params object[] args) { var argsPrinted = args.Length == 0 ? "" : string.Join(" ", args); GenLog.Debug($"{program} {argsPrinted}"); var command = Command.Run(program, args); await command.Task; var stdout = await command.StandardOutput.ReadToEndAsync(); var stderr = await command.StandardError.ReadToEndAsync(); return(command.Result.ExitCode, stdout, stderr); }
protected override void Parse() { GenLog.Debug($"Parsing for NuGet packages in {ProjectFile}"); var xelement = GetParsedXml(ProjectFile); var packageReferences = xelement.Descendants("PackageReference"); foreach (var packageReference in packageReferences) { var id = packageReference.Attribute("Include")?.Value ?? packageReference.Attribute("Update")?.Value; if (id == null) { throw new Exception( $"Invalid syntax in {ProjectFile}: PackageReference with no id"); } var versionRaw = packageReference.Attribute("Version")?.Value; if (versionRaw == null) { if (id.Equals("Microsoft.AspNetCore.App", StringComparison.OrdinalIgnoreCase)) { // This one is special. See https://github.com/aspnet/Docs/issues/6430 continue; } throw new Exception( $"A specific version has not been provided for {id} in {ProjectFile}"); } var result = Statics.GetPackageDefinition(id, versionRaw); if (result == null) { continue; } GenLog.Debug($"Found {result}"); Packages.Add(result); } }