public async Task <bool> RemoveDependency(string packageId, INuGetProjectContext nuGetProjectContext, CancellationToken token) { var json = await GetJsonAsync(); JsonConfigUtility.RemoveDependency(json, packageId); await SaveJsonAsync(json); return(true); }
public void JsonConfigUtility_RemoveDependencyFromNewFile() { // Arrange var json = BasicConfig; // Act JsonConfigUtility.RemoveDependency(json, "testpackage"); JToken val = null; json.TryGetValue("dependencies", out val); // Assert Assert.Null(val); }
public override async Task <bool> UninstallPackageAsync( PackageIdentity packageIdentity, INuGetProjectContext nuGetProjectContext, CancellationToken token) { var json = await GetJsonAsync(); JsonConfigUtility.RemoveDependency(json, packageIdentity.Id); await SaveJsonAsync(json); var workspace = await GetWorkspaceAsync(); var updater = new WorkspaceWriter(); var updated = updater.RemoveEntry(workspace, packageIdentity.Id); await SaveWorkspaceAsync(updated); return(await base.UninstallPackageAsync(packageIdentity, nuGetProjectContext, token)); }