当前位置: 首页>>代码示例>>C#>>正文


C# IVsPackageManager.InstallPackage方法代码示例

本文整理汇总了C#中IVsPackageManager.InstallPackage方法的典型用法代码示例。如果您正苦于以下问题:C# IVsPackageManager.InstallPackage方法的具体用法?C# IVsPackageManager.InstallPackage怎么用?C# IVsPackageManager.InstallPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVsPackageManager的用法示例。


在下文中一共展示了IVsPackageManager.InstallPackage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteCore

        protected override bool ExecuteCore(PackageItem item)
        {
            _activePackageManager = GetActivePackageManager();
            using (_activePackageManager.SourceRepository.StartOperation(RepositoryOperationNames.Install, item.Id, item.Version))
            {
                IList<Project> selectedProjectsList;

                ShowProgressWindow();
                bool isProjectLevel = _activePackageManager.IsProjectLevel(item.PackageIdentity);
                if (isProjectLevel)
                {
                    HideProgressWindow();
                    var selectedProjects = _userNotifierServices.ShowProjectSelectorWindow(
                        Resources.Dialog_OnlineSolutionInstruction,
                        item.PackageIdentity,
                        DetermineProjectCheckState,
                        ignored => true);
                    if (selectedProjects == null)
                    {
                        // user presses Cancel button on the Solution dialog
                        return false;
                    }

                    selectedProjectsList = selectedProjects.ToList();
                    if (selectedProjectsList.Count == 0)
                    {
                        return false;
                    }

                    // save the checked state of projects so that we can restore them the next time
                    SaveProjectCheckStates(selectedProjectsList);

                    ShowProgressWindow();
                }
                else
                {
                    // solution package. just install into the solution
                    selectedProjectsList = new Project[0];
                }

                IList<PackageOperation> operations;
                bool acceptLicense = isProjectLevel ? ShowLicenseAgreement(item.PackageIdentity, _activePackageManager, selectedProjectsList, out operations)
                                                    : ShowLicenseAgreement(item.PackageIdentity, _activePackageManager, targetFramework: null, operations: out operations);
                if (!acceptLicense)
                {
                    return false;
                }

                try
                {
                    RegisterPackageOperationEvents(_activePackageManager, null);

                    _activePackageManager.InstallPackage(
                        selectedProjectsList,
                        item.PackageIdentity,
                        operations,
                        ignoreDependencies: false,
                        allowPrereleaseVersions: IncludePrerelease,
                        logger: this,
                        eventListener: this);
                }
                finally
                {
                    UnregisterPackageOperationEvents(_activePackageManager, null);
                }

                return true;
            }
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:69,代码来源:SolutionOnlineProvider.cs

示例2: ExecuteCommand

 protected virtual void ExecuteCommand(PackageItem item, IVsPackageManager activePackageManager, IList<PackageOperation> operations)
 {
     activePackageManager.InstallPackage(ProjectManager, item.PackageIdentity, operations, ignoreDependencies: false, logger: this);
 }
开发者ID:jacksonh,项目名称:nuget,代码行数:4,代码来源:OnlineProvider.cs

示例3: InstallPackage

        private void InstallPackage(IVsPackageManager packageManager)
        {
            if (packageManager == null)
            {
                return;
            }

            packageManager.DependencyVersion = DependencyVersion;
            packageManager.WhatIf = WhatIf;
            packageManager.InstallPackage(ProjectManager, Id, Version, IgnoreDependencies, IncludePrerelease.IsPresent, logger: this);
        }
开发者ID:Berzeger,项目名称:NuGet,代码行数:11,代码来源:InstallPackageCommand.cs

示例4: ExecuteCommand

 protected virtual void ExecuteCommand(IProjectManager projectManager, PackageItem item, IVsPackageManager activePackageManager, IList<PackageOperation> operations)
 {
     activePackageManager.InstallPackage(projectManager, item.PackageIdentity, operations, ignoreDependencies: false, allowPrereleaseVersions: IncludePrerelease, logger: this);
 }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:4,代码来源:OnlineProvider.cs


注:本文中的IVsPackageManager.InstallPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。