Ejemplo n.º 1
0
        private void GetMsiInstalledPackage(string name, PackageJson package, string requiredVersion, string minimumVersion, string maximumVersion, PackageSourceListRequest request)
        {
            request.Debug(Resources.Messages.DebugInfoCallMethod, PackageProviderName, string.Format(CultureInfo.InvariantCulture, "GetMsiInstalledPackage' - name='{0}', requiredVersion='{1}',minimumVersion='{2}', maximumVersion='{3}'", name, requiredVersion, minimumVersion, maximumVersion));

            var provider = PackageSourceListRequest.FindProvider(request, package.Type, request);

            if (provider != null)
            {
                var packagesInstalled = provider.GetInstalledPackages(package.Name, requiredVersion, minimumVersion, maximumVersion, request);

                if (!packagesInstalled.Any())
                {
                    packagesInstalled = provider.GetInstalledPackages(package.DisplayName, requiredVersion, minimumVersion, maximumVersion, request);
                }
                foreach (var i in packagesInstalled)
                {
                    request.Debug("found a package '{0}.{1}' installed from '{2}'", i.Name, i.Version, i.Source);

                    var info = PackageSourceListRequest.MakeFastPathComplex(i.Source, name, (package.DisplayName ?? ""), i.Version, i.FastPackageReference);

                    _fastPackReftable.AddOrSet(i.FastPackageReference, i);

                    // check if the installed version matches with the one specified in the PSL.json.
                    // If so, we choose PSL.json.
                    var version = i.Version.CompareVersion(package.Version) ? package.Version : i.Version;
                    //we use displayname here because msi provider uses the displayname.
                    request.YieldSoftwareIdentity(info, package.DisplayName, version, i.VersionScheme, i.Summary, package.Source, i.SearchKey, i.FullPath, i.PackageFilename);
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        private static void InstallPackageReference(PackageJson package, PackageSourceListRequest request, SoftwareIdentity[] packages)
        {
            var installRequest = PackageSourceListRequest.ExtendRequest(
                new Dictionary <string, string[]>
            {
                { "Destination", new[] { package.Destination ?? "" } }
            },
                new[] { package.Source ?? "" },
                package.IsTrustedSource,
                request);

            var provider = PackageSourceListRequest.FindProvider(request, package.Type, installRequest, true);

            if (provider == null)
            {
                return;
            }

            var installing = provider.InstallPackage(packages[0], installRequest);

            foreach (var i in installing)
            {
                request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);
                if (request.IsCanceled)
                {
                    installing.Cancel();
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Uninstalls a package
        /// </summary>
        /// <param name="package">package defined in the PackageSourceList</param>
        /// <param name="fastPackageReference"></param>
        /// <param name="request">An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider</param>
        /// <param name="fastPackReftable"></param>
        internal static void UninstallNuGetPackage(PackageJson package, string fastPackageReference, PackageSourceListRequest request, Dictionary <string, SoftwareIdentity> fastPackReftable)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            var destination = package.Destination;

            // PSL will call NuGet to uninstall the package when: 1) a user explictly specifies -providerName psl; or
            // 2) the psl.json file contains the defintion of Destination.
            // Otherwise, NuGet will handle the uninstall-package
            //
            string userSpecifiedProvider    = request.GetOptionValue("ProviderName") ?? request.GetOptionValue("Provider");
            string providerNameFromPipeline = request.GetProviderNameFromFastPathComplex(fastPackageReference);

            if ((string.IsNullOrWhiteSpace(userSpecifiedProvider) || !Constants.ProviderName.EqualsIgnoreCase(userSpecifiedProvider) &&
                 (string.IsNullOrWhiteSpace(providerNameFromPipeline) || !Constants.ProviderName.EqualsIgnoreCase(providerNameFromPipeline))) && string.IsNullOrWhiteSpace(destination))
            {
                request.Verbose(Resources.Messages.UninstallPackageNotSupported, Constants.ProviderName, package.Name, Constants.ProviderNames.NuGet);
                return;
            }

            request.Debug(Resources.Messages.DebugInfoCallMethod, Constants.ProviderName, "Calling UninstallNuGetPackage");

            var unInstallRequest = PackageSourceListRequest.ExtendRequest(
                new Dictionary <string, string[]>
            {
                { "Destination", new[] { destination } }
            }, null, request);

            var provider = PackageSourceListRequest.FindProvider(request, package.Type, request, true);

            if (provider != null)
            {
                request.Debug("{0}: Using the provider '{1} to uninstall the package '{2}'", Constants.ProviderName, provider.Name, package.Name);

                if (!fastPackReftable.ContainsKey(fastPackageReference))
                {
                    request.WriteError(ErrorCategory.InvalidData, fastPackageReference, Resources.Messages.FailedToGetPackageObject, Constants.ProviderName, fastPackageReference);
                    return;
                }

                var p = fastPackReftable[fastPackageReference];

                //calling NuGet for uninstall
                var installing = provider.UninstallPackage(p, unInstallRequest);

                foreach (var i in installing)
                {
                    request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);

                    if (request.IsCanceled)
                    {
                        installing.Cancel();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void UnInstallMsiPackage(PackageSourceListRequest request, string fastPath, PackageJson package)
        {
            request.Debug(Resources.Messages.DebugInfoCallMethod, PackageProviderName, string.Format(CultureInfo.InvariantCulture, "UnInstallMsiPackage' - name='{0}', fastPath='{1}'", package.Name, fastPath));

            string sourceLocation;
            string id;
            string displayName;
            string version;
            string fastPackageReference;

            if (!request.TryParseFastPathComplex(fastPath: fastPath, regex: PackageSourceListRequest.RegexFastPathComplex, location: out sourceLocation, id: out id, displayname: out displayName, version: out version, fastpath: out fastPackageReference))
            {
                //we don't need to error out even if fastpath is not correct because msi provider is expected to handle the uninstall-package.
                request.Verbose(Resources.Messages.UnsupportMSIUninstall, Constants.ProviderName, package.Name);
                return;
            }

            // Normally uninstall-package will be handled by MSI provider. Here we added a special case for handling uninstall-package nodejs
            // which msi provider unable to deal with (node.js only for msi)
            if (id != null && id.EqualsIgnoreCase("nodejs"))
            {
                var provider = PackageSourceListRequest.FindProvider(request, Constants.ProviderNames.Msi, request);

                if (provider != null)
                {
                    if (!_fastPackReftable.ContainsKey(fastPackageReference))
                    {
                        request.WriteError(ErrorCategory.InvalidData, fastPackageReference, Resources.Messages.FailedToGetPackageObject, Constants.ProviderName, fastPackageReference);
                        return;
                    }

                    request.Verbose(Resources.Messages.UninstallingPackage, Constants.ProviderName, package.Name);

                    var p = _fastPackReftable[fastPackageReference];

                    var installing = provider.UninstallPackage(p, request);

                    foreach (var i in installing)
                    {
                        request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme,
                                                      i.Summary, package.Source, i.SearchKey, i.FullPath, i.PackageFilename);
                        if (request.IsCanceled)
                        {
                            installing.Cancel();
                        }
                        return;
                    }
                }
            }
            else
            {
                //no-op for uninstalling the msi packages. only install-package nodejs is supported because msi can not handle it
                request.Verbose(Resources.Messages.UnsupportMSIUninstall, Constants.ProviderName, package.Name);
                return;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Uninstalls a package
        /// </summary>
        /// <param name="package">package defined in the PackageSourceList</param>
        /// <param name="fastPackageReference"></param>
        /// <param name="request">An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider</param>
        /// <param name="fastPackReftable"></param>
        internal static void UninstallPowershellArtifacts(PackageJson package, string fastPackageReference, PackageSourceListRequest request, Dictionary <string, SoftwareIdentity> fastPackReftable)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            // If a user explicitly specifies -providerName psl, e.g., uninstall-package -providername psl -name xjea,
            // PSL will call PowerShellGet to uninstall the package.
            // Otherwise, it is expected that PowerShellGet will handle the uninstall-package and PSL won't
            // participate in the uninstall operation, e.g., uninstall-package xjea
            string userSpecifiedProvider    = request.GetOptionValue("ProviderName") ?? request.GetOptionValue("Provider");
            string providerNameFromPipeline = request.GetProviderNameFromFastPathComplex(fastPackageReference);

            if ((string.IsNullOrWhiteSpace(userSpecifiedProvider) || !Constants.ProviderName.EqualsIgnoreCase(userSpecifiedProvider)) &&
                string.IsNullOrWhiteSpace(providerNameFromPipeline) || !Constants.ProviderName.EqualsIgnoreCase(providerNameFromPipeline))
            {
                request.Verbose(Resources.Messages.UninstallPackageNotSupported, Constants.ProviderName, package.Name, Constants.ProviderNames.PowerShellGet);
                return;
            }

            request.Debug(Resources.Messages.DebugInfoCallMethod, Constants.ProviderName, "Calling UninstallPowershellArtifacts");

            var provider = PackageSourceListRequest.FindProvider(request, package.Type, request, true);

            if (provider != null)
            {
                request.Debug("{0}: Using the provider '{1} to uninstall the package '{2}'", Constants.ProviderName, provider.Name, package.Name);

                if (!fastPackReftable.ContainsKey(fastPackageReference))
                {
                    request.WriteError(Internal.ErrorCategory.InvalidData, fastPackageReference, Resources.Messages.FailedToGetPackageObject, Constants.ProviderName, fastPackageReference);
                    return;
                }

                var p = fastPackReftable[fastPackageReference];

                //calling NuGet for uninstall
                var installing = provider.UninstallPackage(p, request);

                foreach (var i in installing)
                {
                    request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);

                    if (request.IsCanceled)
                    {
                        installing.Cancel();
                    }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Uninstalls a package
        /// </summary>
        /// <param name="package">package defined in the PackageSourceList</param>
        /// <param name="fastPackageReference"></param>
        /// <param name="request">An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider</param>
        /// <param name="fastPackReftable"></param>
        internal static void UninstallNuGetPackage(PackageJson package, string fastPackageReference, PackageSourceListRequest request, Dictionary <string, SoftwareIdentity> fastPackReftable)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug(Resources.Messages.DebugInfoCallMethod, Constants.ProviderName, string.Format(CultureInfo.InvariantCulture, "UninstallNuGetPackage' - fastReference='{0}'", fastPackageReference));

            var unInstallRequest = PackageSourceListRequest.ExtendRequest(
                new Dictionary <string, string[]>
            {
                { "Destination", new[] { package.Destination ?? "" } }
            }, null, package.IsTrustedSource, request);

            var provider = PackageSourceListRequest.FindProvider(request, package.Type, request, true);

            if (provider != null)
            {
                request.Debug("{0}: Using the provider '{1} to uninstall the package '{2}'", Constants.ProviderName, provider.Name, package.Name);

                if (!fastPackReftable.ContainsKey(fastPackageReference))
                {
                    request.WriteError(ErrorCategory.InvalidData, fastPackageReference, Resources.Messages.FailedToGetPackageObject, Constants.ProviderName, fastPackageReference);
                    return;
                }

                var p = fastPackReftable[fastPackageReference];

                //calling NuGet for uninstall
                var installing = provider.UninstallPackage(p, unInstallRequest);

                foreach (var i in installing)
                {
                    request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);

                    if (request.IsCanceled)
                    {
                        installing.Cancel();
                    }
                }
            }
        }
Ejemplo n.º 7
0
        internal static void GetInstalledPowershellArtifacts(PackageJson package, string requiredVersion, string minimumVersion, string maximumVersion, Dictionary <string, SoftwareIdentity> fastPackReftable, PackageSourceListRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug(Resources.Messages.DebugInfoCallMethod, Constants.ProviderName, string.Format(CultureInfo.InvariantCulture, "GetInstalledPowershellArtifacts' - name='{0}', requiredVersion='{1}',minimumVersion='{2}', maximumVersion='{3}'", package.Name, requiredVersion, minimumVersion, maximumVersion));

            var provider = PackageSourceListRequest.FindProvider(request, package.Type, request);

            if (provider == null)
            {
                return;
            }

            //calling the PowerShellGet provider
            request.Debug("Calling '{0}' provider to get installed packages '{1}.{2}'", provider.Name, package.Name, package.Version);

            var packagesInstalled = provider.GetInstalledPackages(package.Name, requiredVersion, minimumVersion, maximumVersion, request).ToArray();

            if (packagesInstalled == null || !packagesInstalled.Any())
            {
                request.Verbose(Resources.Messages.NumberOfPackagesRecevied, 0, provider.Name, "GetInstalledPackages");
                return;
            }

            //Make sure the packages found are defined in the psl.json
            foreach (var i in packagesInstalled.Where(each => new SemanticVersion(each.Version) == new SemanticVersion(package.Version)))
            {
                request.Debug("Found an installed package '{0}.{1} from {2}' ", i.Name, i.Version, i.Source);
                string userSpecifiedProvider = request.GetOptionValue("ProviderName") ?? request.GetOptionValue("Provider");
                var    info = PackageSourceListRequest.MakeFastPathComplex(i.Source, i.Name, "", i.Version, "", userSpecifiedProvider ?? "");

                fastPackReftable.AddOrSet(info, i);

                // check if the installed version matches with the one specified in the PSL.json.
                // If so, we choose PSL.json.
                var version = i.Version.CompareVersion(package.Version) ? package.Version : i.Version;
                request.YieldSoftwareIdentity(info, i.Name, version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);
            }
        }
Ejemplo n.º 8
0
        internal static void GeInstalledNuGetPackages(PackageJson package, string requiredVersion, string minimumVersion, string maximumVersion, Dictionary <string, SoftwareIdentity> fastPackReftable, PackageSourceListRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug(Resources.Messages.DebugInfoCallMethod, Constants.ProviderName, string.Format(CultureInfo.InvariantCulture, "GeInstalledNuGetPackages' - name='{0}', requiredVersion='{1}',minimumVersion='{2}', maximumVersion='{3}'", package.Name, requiredVersion, minimumVersion, maximumVersion));

            //clone the request
            //nuget provider may not know the location of the package gets installed.
            //we need to pass around the destination path to nuget provider
            var installedRequest = PackageSourceListRequest.ExtendRequest(
                new Dictionary <string, string[]> {
                { "Destination", new[] { package.Destination } }
            }, null, request);

            var provider = PackageSourceListRequest.FindProvider(request, package.Type, request);

            if (provider != null)
            {
                //calling NuGet provider
                var packagesInstalled = provider.GetInstalledPackages(package.Name, requiredVersion, minimumVersion, maximumVersion, installedRequest);
                if (packagesInstalled != null)
                {
                    //Make sure the packages found are defined in the psl.json
                    foreach (var i in packagesInstalled.Where(each => new SemanticVersion(each.Version) == new SemanticVersion(package.Version)))
                    {
                        request.Debug("Found an installed package '{0}.{1} from {2}' ", i.Name, i.Version, i.Source);
                        string userSpecifiedProvider = request.GetOptionValue("ProviderName") ?? request.GetOptionValue("Provider");
                        var    info = PackageSourceListRequest.MakeFastPathComplex(i.Source, i.Name, "", i.Version, "", userSpecifiedProvider ?? "");

                        fastPackReftable.AddOrSet(info, i);

                        // make it semver because in find-package we use semver
                        var version = i.Version.CompareVersion(package.Version) ? package.Version : i.Version;
                        request.YieldSoftwareIdentity(info, i.Name, version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private static IEnumerable <PackageJson> GetDependencies(PackageJson packageJson, PackageSourceListRequest request)
        {
            if (packageJson.DependencyObjects == null)
            {
                yield break;
            }

            bool force = request.GetOptionValue("Force") != null;

            foreach (var dep in packageJson.DependencyObjects.Where(dep => (dep != null) && !dep.IsCommonDefinition))
            {
                if (!force)
                {
                    var provider = PackageSourceListRequest.FindProvider(request, dep.Type, request, true);

                    if (provider == null)
                    {
                        //FindProvider logged an error already
                        break;
                    }
                    //Check whether the dependency package is installed
                    var installedPackages = provider.GetInstalledPackages(dep.Name, requiredVersion: null, minimumVersion: dep.Version, maximumVersion: null, requestObject: request);

                    if (installedPackages == null || !installedPackages.Any())
                    {
                        request.Verbose(Resources.Messages.DependencyNotInstalled, dep.Name);
                        yield return(dep);
                    }
                    else
                    {
                        request.Verbose(Resources.Messages.DependencyInstalled, dep.Name);
                    }
                }
                else
                {
                    yield return(dep);
                }
            }
        }
        internal static void InstallPowershellArtifacts(PackageJson package, string fastPath, PackageSourceListRequest request)
        {
            var provider1 = PackageSourceListRequest.FindProvider(request, package.Type, request, true);

            if (provider1 == null)
            {
                return;
            }

            // As the PowerShellGet may access the -source via $request.Options or PackageSources,
            // so we need to fill in both options and sources parameters
            var installRequest = PackageSourceListRequest.ExtendRequest(new Dictionary <string, string[]>
            {
                { "Source", new[] { package.Source ?? "" } }
            }, new[] { package.Source ?? "" }, package.IsTrustedSource, request);

            var psid = PackageSourceListRequest.CreateCanonicalId(package, Constants.ProviderNames.PowerShellGet);
            var pkgs = request.PackageManagementService.FindPackageByCanonicalId(psid, installRequest)
                       .Where(each => new SemanticVersion(each.Version) == new SemanticVersion(package.Version)).ToArray();

            switch (pkgs.Length)
            {
            case 0:
                request.Warning(Resources.Messages.CannotFindPackage, Constants.ProviderName, psid);
                break;

            case 1:
                InstallPackageViaPowerShellGet(package, request, pkgs);
                break;

            default:
                request.Warning(Resources.Messages.FoundMorePackages, Constants.ProviderName, pkgs.Length, psid);
                break;
            }
            return;
        }
        private static void InstallPackageViaPowerShellGet(PackageJson packageJson, PackageSourceListRequest request, SoftwareIdentity[] packages)
        {
            var provider = PackageSourceListRequest.FindProvider(request, packageJson.Type, request, true);

            if (provider == null)
            {
                return;
            }

            IHostApi installRequest = request;

            if (provider.Name.EqualsIgnoreCase(Constants.ProviderNames.PowerShellGet) && !request.ProviderServices.IsElevated)
            {
                // if we're not elevated, we want powershellget to install to the user scope
                installRequest = PackageSourceListRequest.ExtendRequest(
                    new Dictionary <string, string[]> {
                    { "Scope", new[] { "CurrentUser" } }
                }, null, packageJson.IsTrustedSource, request);
            }
            else
            {
                installRequest = PackageSourceListRequest.ExtendRequest(
                    new Dictionary <string, string[]> {
                    { "Destination", new[] { packageJson.Destination ?? "" } }
                }, null, packageJson.IsTrustedSource, request);
            }

            request.Debug("Calling '{0}' provider to install the package '{1}.{2}'", provider.Name, packageJson.Name, packageJson.Version);

            var installing = provider.InstallPackage(packages[0], installRequest);

            if (installing == null || !installing.Any())
            {
                request.Verbose(Resources.Messages.NumberOfPackagesRecevied, 0, provider.Name, "InstallPackage");
                request.Warning(Resources.Messages.FailToInstallPackage, Constants.ProviderName, packages[0].Name);
                return;
            }

            int packagesReceived = 0;

            foreach (var i in installing)
            {
                request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);

                if (request.IsCanceled)
                {
                    installing.Cancel();
                }
                else
                {
                    request.Verbose(Resources.Messages.SuccessfullyInstalled, "{0}.{1}".format(packageJson.Name, packageJson.Version));
                    //load provider
                    if (packageJson.IsPackageProvider)
                    {
                        //Per provider development guidance: provider name and module name should be the same otherwise we can not import it.
                        request.PackageManagementService.ImportPackageProvider(request, packageJson.Name, null, null, null, isRooted: false, force: false);
                    }
                }
                packagesReceived++;
            }

            request.Verbose(Resources.Messages.NumberOfPackagesRecevied, packagesReceived, provider.Name, "install-package");
        }
Ejemplo n.º 12
0
        private void UnInstallMsiPackage(PackageSourceListRequest request, string fastPath, PackageJson package)
        {
            request.Debug(Resources.Messages.DebugInfoCallMethod, PackageProviderName, string.Format(CultureInfo.InvariantCulture, "UnInstallMsiPackage' - name='{0}'", package.Name));

            string sourceLocation;
            string id;
            string displayName;
            string version;
            string fastPackageReference;
            string providerNameFromPipeline;

            if (!request.TryParseFastPathComplex(fastPath: fastPath, regex: PackageSourceListRequest.RegexFastPathComplex, location: out sourceLocation, id: out id, displayname: out displayName, version: out version, fastpath: out fastPackageReference, providerName: out providerNameFromPipeline))
            {
                //we don't need to error out even if fastpath is not correct because msi provider is expected to handle the uninstall-package.
                request.Verbose(Resources.Messages.UninstallPackageNotSupported, Constants.ProviderName, package.Name, Constants.ProviderNames.Msi);

                return;
            }

            // Normally uninstall-package will be handled by MSI provider, so we do not need to handle it here.
            // But there are some special cases where MSI provider does not work well.
            //
            // For example, after installing the nodejs.msi (install-package nodejs), the product name appears to be "node.js".
            // After installing the PowerShell.msi package (install-package PowerShell), the product name appears to be "PowerShell_<Version>".
            // The msi provider works well if you pass in the product display name. In this case you need to use "PowerShell_Version" in
            // the Get-Package and UnInstall-Package.
            // But the msi provider will not work if you "Uninstall-Package PowerShell" or  "Uninstall-Package nodejs"

            // Here we add some logic to let PSL try both well-known package name and the displayname.

            string userSpecifiedProvider = request.GetOptionValue("ProviderName") ?? request.GetOptionValue("Provider");

            if ((!string.IsNullOrWhiteSpace(id) &&
                 (!string.IsNullOrWhiteSpace(displayName)) &&
                 (!id.EqualsIgnoreCase(displayName)) &&
                 (id.EqualsIgnoreCase(package.Name))) ||
                (!string.IsNullOrWhiteSpace(providerNameFromPipeline) && Constants.ProviderName.EqualsIgnoreCase(providerNameFromPipeline)) ||
                (!string.IsNullOrWhiteSpace(userSpecifiedProvider) && Constants.ProviderName.EqualsIgnoreCase(userSpecifiedProvider)))
            {
                var provider = PackageSourceListRequest.FindProvider(request, Constants.ProviderNames.Msi, request);

                if (provider != null)
                {
                    if (!_fastPackReftable.ContainsKey(fastPackageReference))
                    {
                        request.WriteError(ErrorCategory.InvalidData, fastPackageReference, Resources.Messages.FailedToGetPackageObject, Constants.ProviderName, fastPackageReference);
                        return;
                    }

                    request.Verbose(Resources.Messages.UninstallingPackage, Constants.ProviderName, package.Name);

                    var p = _fastPackReftable[fastPackageReference];

                    var installing = provider.UninstallPackage(p, request);

                    foreach (var i in installing)
                    {
                        request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme,
                                                      i.Summary, package.Source, i.SearchKey, i.FullPath, i.PackageFilename);
                        if (request.IsCanceled)
                        {
                            installing.Cancel();
                        }
                        return;
                    }
                }
            }
            else
            {
                //no-op for uninstalling the msi packages. only install-package nodejs is supported because msi can not handle it
                request.Verbose(Resources.Messages.UninstallPackageNotSupported, Constants.ProviderName, package.Name, Constants.ProviderNames.Msi);
                return;
            }
        }