public Task Execute(string[] commandLineArguments) { return(Task.Run(() => { optionGroups.Parse(commandLineArguments); if (string.IsNullOrWhiteSpace(id)) { throw new CommandException("An ID is required"); } if (includes.All(string.IsNullOrWhiteSpace)) { includes.Add("**"); } if (string.IsNullOrWhiteSpace(basePath)) { basePath = Path.GetFullPath(Directory.GetCurrentDirectory()); } if (string.IsNullOrWhiteSpace(outFolder)) { outFolder = Path.GetFullPath(Directory.GetCurrentDirectory()); } if (version == null) { var now = DateTime.Now; version = new SemanticVersion(now.Year, now.Month, now.Day, now.Hour * 10000 + now.Minute * 100 + now.Second); } if (authors.All(string.IsNullOrWhiteSpace)) { authors.Add(Environment.GetEnvironmentVariable("USERNAME") + "@" + Environment.GetEnvironmentVariable("USERDOMAIN")); } if (string.IsNullOrWhiteSpace(description)) { description = "A deployment package created from files on disk."; } string allReleaseNotes = null; if (!string.IsNullOrWhiteSpace(releaseNotesFile)) { if (!File.Exists(releaseNotesFile)) { log.Warning("The release notes file '{Path:l}' could not be found", releaseNotesFile); } else { allReleaseNotes = fileSystem.ReadFile(releaseNotesFile); } } if (!string.IsNullOrWhiteSpace(releaseNotes)) { if (allReleaseNotes != null) { allReleaseNotes += Environment.NewLine + releaseNotes; } else { allReleaseNotes = releaseNotes; } } var metadata = new ManifestMetadata { Id = id, Authors = authors, Description = description, Version = version.ToNuGetVersion(), }; if (!string.IsNullOrWhiteSpace(allReleaseNotes)) { metadata.ReleaseNotes = allReleaseNotes; } if (!string.IsNullOrWhiteSpace(title)) { metadata.Title = title; } log.Information("Packing {PackageId:l} version {Version}...", id, version); packageBuilder.BuildPackage(basePath, includes, metadata, outFolder, overwrite); log.Information("Done."); })); }