public override int Run(string fileOrDirectory) { if (RemainingArguments.Count != 1) { throw new GracefulException(LocalizableStrings.SpecifyExactlyOnePackageReference); } var projectFilePath = string.Empty; if (!File.Exists(fileOrDirectory)) { projectFilePath = MsbuildProject.GetProjectFileFromDirectory(fileOrDirectory).FullName; } else { projectFilePath = fileOrDirectory; } var tempDgFilePath = string.Empty; if (!_noRestoreOption.HasValue()) { // Create a Dependency Graph file for the project tempDgFilePath = Path.GetTempFileName(); GetProjectDependencyGraph(projectFilePath, tempDgFilePath); } var result = NuGetCommand.Run(TransformArgs(RemainingArguments.First(), tempDgFilePath, projectFilePath)); DisposeTemporaryFile(tempDgFilePath); return(result); }
public override int Run(string fileOrDirectory) { if (RemainingArguments.Count != 1) { throw new GracefulException(LocalizableStrings.SpecifyExactlyOnePackageReference); } var projectFilePath = string.Empty; if (!File.Exists(fileOrDirectory)) { projectFilePath = MsbuildProject.GetProjectFileFromDirectory(fileOrDirectory).FullName; } else { projectFilePath = fileOrDirectory; } var packageToRemove = RemainingArguments.First(); var result = NuGetCommand.Run(TransformArgs(packageToRemove, projectFilePath)); return(result); }