コード例 #1
0
        public override async Task <bool> UninstallPackageAsync(PackageIdentity packageIdentity, INuGetProjectContext nuGetProjectContext, CancellationToken token)
        {
            nuGetProjectContext.Log(MessageLevel.Info, Strings.UninstallingPackage, packageIdentity);

            var args = new Dictionary <string, object>();

            await _project.UninstallPackageAsync(
                new NuGetPackageMoniker
            {
                Id      = packageIdentity.Id,
                Version = packageIdentity.Version.ToNormalizedString()
            },
                args,
                logger : null,
                progress : null,
                cancellationToken : token);

            // It's possible that the underlying project is trying to pass us back some state to be
            // returned to it in a subsequent install of the same package identity.
            object state;

            if (args.TryGetValue(StateKey, out state))
            {
                _packageUpdateState[packageIdentity.Id] = state;
            }

            return(true);
        }
コード例 #2
0
        public override Task UninstallPackage(PackageIdentity id, IExecutionLogger logger, CancellationToken cancelToken)
        {
            var args = new Dictionary <string, object>();
            var task = _nugetAwareProject.UninstallPackageAsync(
                new NuGetPackageMoniker
            {
                Id      = id.Id,
                Version = id.Version.ToString()
            },
                args,
                logger: null,
                progress: null,
                cancellationToken: cancelToken);

            return(task);
        }
コード例 #3
0
        public override async Task <bool> UninstallPackageAsync(PackageIdentity packageIdentity, INuGetProjectContext nuGetProjectContext, CancellationToken token)
        {
            nuGetProjectContext.Log(ProjectManagement.MessageLevel.Info, Strings.UninstallingPackage, packageIdentity);

            var args = new Dictionary <string, object>();
            await _project.UninstallPackageAsync(
                new NuGetPackageMoniker
            {
                Id      = packageIdentity.Id,
                Version = packageIdentity.Version.ToNormalizedString()
            },
                args,
                logger : null,
                progress : null,
                cancellationToken : token);

            return(true);
        }
コード例 #4
0
        private void RemovePackageReferenceFromNuGetAwareProject(IPackage package)
        {
            INuGetPackageManager project = this.Project as INuGetPackageManager;
            string fullName = package.GetFullName();

            object[] args = new object[] { fullName, this.Project.ProjectName };
            this.Logger.Log(MessageLevel.Info, NuGetResources.Log_BeginRemovePackageReference, args);
            Dictionary <string, object> options = new Dictionary <string, object>();

            using (CancellationTokenSource source = new CancellationTokenSource())
            {
                NuGetPackageMoniker moniker1 = new NuGetPackageMoniker();
                moniker1.Id      = package.Id;
                moniker1.Version = package.Version.ToString();
                project.UninstallPackageAsync(moniker1, options, null, null, source.Token).Wait();
            }
            object[] objArray2 = new object[] { fullName, this.Project.ProjectName };
            this.Logger.Log(MessageLevel.Info, NuGetResources.Log_SuccessfullyRemovedPackageReference, objArray2);
        }
コード例 #5
0
 public Task UninstallPackageAsync(INuGetPackageMoniker package, IReadOnlyDictionary <string, object> options, System.IO.TextWriter logger, IProgress <INuGetPackageInstallProgress> progress, CancellationToken cancellationToken)
 {
     return(_nugetProject.UninstallPackageAsync(package, options, logger, progress, cancellationToken));
 }