protected override int Execute() { var program = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Path.Combine(DotNetRunner.CliFolderPathCalculator.ToolsShimPath, PackageId) : PackageId; var run = ProcessRunner.Create(program) .IsGenerator() .WithArgument(InputFileName); foreach (var args in RemainingArguments) { if (args.StartsWith("--")) { run.WithArgument(args); } } run.Execute(false); return(0); }
protected override int Execute() { base.Execute(); if (FromCli && !string.IsNullOrEmpty(PackageIdArgument.ParsedValue)) { var packageId = PackageIdArgument.ParsedValue; var resolvePackageResult = DotNetRunner.ResolvePackage(packageId, SourceOption.ParsedValue, UpdateOption.HasValue(), string.Empty); if (resolvePackageResult.success) { var program = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Path.Combine(DotNetRunner.CliFolderPathCalculator.ToolsShimPath, resolvePackageResult.packageId) : resolvePackageResult.packageId; var run = ProcessRunner.Create(program) .IsGenerator() .WithArgument(Name); foreach (var option in Options) { if (option.HasValue()) { run.WithArgument("--" + option.LongName, option.Value()); } } run.Execute(false); return(1); } Log.Error($"Could not execute {Name} command for this packageId."); return(-1); } return(0); }