public async Task <bool> RemoveDependency(string packageId,
                                                  INuGetProjectContext nuGetProjectContext,
                                                  CancellationToken token)
        {
            var json = await GetJsonAsync();

            JsonConfigUtility.RemoveDependency(json, packageId);

            await SaveJsonAsync(json);

            return(true);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }