• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IVsPackageManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: VsSolution

        public VsSolution(DteSolution dteSolution, ISolutionManager solutionManager, IVsPackageManager packageManager)
        {
            _name = String.Format(
                CultureInfo.CurrentCulture,
                Strings.Label_Solution,
                dteSolution.GetName());
            _solution = solutionManager;
            _packageManager = packageManager;

            var repo = (SharedPackageRepository)packageManager.LocalRepository;
            _installedSolutionLevelPackages = new CoreInteropInstalledPackagesList(
                new PackageReferenceRepository(repo.PackageReferenceFile.FullPath, repo));

            DteSolution = dteSolution;

            // Add V2-related interop features
            AddFeature(() => packageManager.LocalRepository);
            AddFeature<IPackageManager>(() => packageManager);
            AddFeature<IPackageCacheRepository>(() => MachineCache.Default);

            // the source repository of the local repo of the solution
            AddFeature<SourceRepository>(() =>
            {
                var localRepo = new NuGet.Client.Interop.V2SourceRepository(
                    null,
                    packageManager.LocalRepository,
                    "");
                return localRepo;
            });

            // Add PowerShell feature
            AddFeature<PowerShellScriptExecutor>(() =>
                new VsPowerShellScriptExecutor(ServiceLocator.GetInstance<IScriptExecutor>()));
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:34,代码来源:VsSolution.cs


示例2: GetActivePackageManager

        protected internal override IVsPackageManager GetActivePackageManager()
        {
            if (_recentPackageManager == null)
            {
                var repository = _packageSourceProvider.GetAggregate(_packageRepositoryFactory, ignoreFailingRepositories: true);
                _recentPackageManager = _packageManagerFactory.CreatePackageManager(repository, useFallbackForDependencies: false);
            }

            return _recentPackageManager;
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:10,代码来源:RecentProvider.cs


示例3: InstalledProvider

 public InstalledProvider(
     IVsPackageManager packageManager,
     Project project,
     IProjectManager projectManager,
     ResourceDictionary resources,
     ProviderServices providerServices,
     IProgressProvider progressProvider)
     : base(project, projectManager, resources, providerServices, progressProvider)
 {
     _packageManager = packageManager;
 }
开发者ID:grendello,项目名称:nuget,代码行数:11,代码来源:InstalledProvider.cs


示例4: SolutionInstalledProvider

 public SolutionInstalledProvider(
     IVsPackageManager packageManager,
     IPackageRepository localRepository,
     ResourceDictionary resources,
     ProviderServices providerServices,
     IProgressProvider progressProvider,
     ISolutionManager solutionManager,
     IPackageRestoreManager packageRestoreManager)
     : base(packageManager, null, localRepository, resources, providerServices, progressProvider, solutionManager, packageRestoreManager)
 {
     _userNotifierServices = providerServices.UserNotifierServices;
 }
开发者ID:rikoe,项目名称:nuget,代码行数:12,代码来源:SolutionInstalledProvider.cs


示例5: MockPackagesProvider

 public MockPackagesProvider(IPackageRepository localRepository, IVsPackageManager packageManagerr, IEnumerable<string> supportedFrameworks)
     : base(localRepository, 
            new ResourceDictionary(), 
            new ProviderServices(
                new Mock<IUserNotifierServices>().Object,
                new Mock<IProgressWindowOpener>().Object,
                new Mock<IProviderSettings>().Object,
                new Mock<IScriptExecutor>().Object,
                new MockOutputConsoleProvider(),
                new Mock<IVsCommonOperations>().Object),
            new Mock<IProgressProvider>().Object, 
            new Mock<ISolutionManager>().Object)
 {
     _supportedFrameworks = supportedFrameworks;
 }
开发者ID:monoman,项目名称:NugetCracker,代码行数:15,代码来源:MockPackagesProvider.cs


示例6: InstalledProvider

        public InstalledProvider(
            IVsPackageManager packageManager,
            Project project,
            IPackageRepository localRepository,
            ResourceDictionary resources,
            ProviderServices providerServices,
            IProgressProvider progressProvider,
            ISolutionManager solutionManager)
            : base(localRepository, resources, providerServices, progressProvider, solutionManager)
        {

            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }

            _packageManager = packageManager;
            _project = project;
            _userNotifierServices = providerServices.UserNotifierServices;
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:20,代码来源:InstalledProvider.cs


示例7: InstalledProvider

        public InstalledProvider(
            IVsPackageManager packageManager,
            Project project,
            IPackageRepository localRepository,
            ResourceDictionary resources,
            ProviderServices providerServices,
            IProgressProvider progressProvider,
            ISolutionManager solutionManager,
            IPackageRestoreManager packageRestoreManager)
            : base(localRepository, resources, providerServices, progressProvider, solutionManager)
        {
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }

            _packageManager = packageManager;
            _project = project;
            _targetFramework = _project.GetTargetFrameworkName();
            _userNotifierServices = providerServices.UserNotifierServices;
            _packageRestoreManager = packageRestoreManager;
            _packageRestoreManager.PackagesMissingStatusChanged += OnMissPackagesChanged;
        }
开发者ID:Mailaender,项目名称:xamarin-nuget,代码行数:23,代码来源:InstalledProvider.cs


示例8: 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


示例9: ShowLicenseAgreement

        protected bool ShowLicenseAgreement(IVsPackageManager packageManager, IEnumerable<PackageOperation> operations)
        {
            var licensePackages = from o in operations
                                  where o.Action == PackageAction.Install &&
                                        o.Package.RequireLicenseAcceptance &&
                                        !packageManager.LocalRepository.Exists(o.Package)
                                  select o.Package;

            // display license window if necessary
            if (licensePackages.Any())
            {
                // hide the progress window if we are going to show license window
                HideProgressWindow();

                bool accepted = _providerServices.UserNotifierServices.ShowLicenseWindow(licensePackages);
                if (!accepted)
                {
                    return false;
                }

                ShowProgressWindow();
            }

            return true;
        }
开发者ID:themotleyfool,项目名称:NuGet,代码行数:25,代码来源:PackagesProviderBase.cs


示例10: OnAfterPackageOperation

 public void OnAfterPackageOperation(IVsPackageManager packageManager)
 {
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:3,代码来源:NullPackageOperationEventListener.cs


示例11: ShowLicenseAgreementForAllPackages

        protected bool ShowLicenseAgreementForAllPackages(IVsPackageManager activePackageManager, out IList<PackageOperation> allOperations, out IList<IPackage> packagesByDependencyOrder)
        {
            allOperations = new List<PackageOperation>();
            var allPackages = SelectedNode.GetPackages(String.Empty, IncludePrerelease);
            if (_project.SupportsINuGetProjectSystem())
            {
                packagesByDependencyOrder = allPackages.ToList();
                foreach (var package in allPackages)
                {
                    allOperations.Add(new PackageOperation(package, PackageAction.Install));
                }
            }
            else
            {
                var installWalker = new InstallWalker(
                    LocalRepository,
                    activePackageManager.SourceRepository,
                    _project.GetTargetFrameworkName(),
                    logger: this,
                    ignoreDependencies: false,
                    allowPrereleaseVersions: IncludePrerelease,
                    dependencyVersion: activePackageManager.DependencyVersion);
                allOperations = installWalker.ResolveOperations(allPackages, out packagesByDependencyOrder);
            }

            return ShowLicenseAgreement(activePackageManager, allOperations);
        }
开发者ID:Mailaender,项目名称:xamarin-nuget,代码行数:27,代码来源:UpdatesProvider.cs


示例12: ExecuteCommandOnProject

 protected void ExecuteCommandOnProject(Project activeProject, PackageItem item, IVsPackageManager activePackageManager, IList<PackageOperation> operations)
 {
     IProjectManager projectManager = null;
     try
     {
         projectManager = activePackageManager.GetProjectManager(activeProject);
         RegisterPackageOperationEvents(activePackageManager, projectManager);
         ExecuteCommand(projectManager, item, activePackageManager, operations);
     }
     finally
     {
         if (projectManager != null)
         {
             UnregisterPackageOperationEvents(activePackageManager, projectManager);
         }
     }
 }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:17,代码来源:OnlineProvider.cs


示例13: CreateInstalledProvider

        private static InstalledProvider CreateInstalledProvider(
            IVsPackageManager packageManager = null,
            IPackageRepository localRepository = null,
            Project project = null,
            IScriptExecutor scriptExecutor = null,
            ISolutionManager solutionManager = null,
            IPackageRestoreManager packageRestoreManager = null)
        {
            if (packageManager == null)
            {
                packageManager = new Mock<IVsPackageManager>().Object;
            }

            var mockProgressWindowOpener = new Mock<IProgressWindowOpener>();

            if (project == null)
            {
                project = new Mock<Project>().Object;
            }

            if (scriptExecutor == null)
            {
                scriptExecutor = new Mock<IScriptExecutor>().Object;
            }

            var services = new ProviderServices(
                null,
                mockProgressWindowOpener.Object,
                new Mock<IProviderSettings>().Object,
                new Mock<IUpdateAllUIService>().Object,
                scriptExecutor,
                new MockOutputConsoleProvider(),
                new Mock<IVsCommonOperations>().Object
            );

            if (localRepository == null)
            {
                localRepository = new MockPackageRepository();
            }

            if (solutionManager == null)
            {
                solutionManager = new Mock<ISolutionManager>().Object;
            }

            if (packageRestoreManager == null)
            {
                packageRestoreManager = new Mock<IPackageRestoreManager>().Object;
            }

            return new InstalledProvider(
                packageManager,
                project,
                localRepository,
                new System.Windows.ResourceDictionary(),
                services,
                new Mock<IProgressProvider>().Object,
                solutionManager,
                packageRestoreManager);
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:60,代码来源:InstalledProviderTest.cs


示例14: ShowLicenseAgreement

 protected bool ShowLicenseAgreement(
     IPackage package,
     IVsPackageManager packageManager,
     FrameworkName targetFramework,
     out IList<PackageOperation> operations)   
 {
     var walker = new InstallWalker(
         LocalRepository,
         packageManager.SourceRepository,
         targetFramework,
         this,
         ignoreDependencies: false,
         allowPrereleaseVersions: IncludePrerelease,
         dependencyVersion: packageManager.DependencyVersion);
     operations = walker.ResolveOperations(package).ToList();
     return ShowLicenseAgreement(packageManager, operations);
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:17,代码来源:PackagesProviderBase.cs


示例15: ResolveActionsForUpdateAll

 private IEnumerable<Resolver.PackageAction> ResolveActionsForUpdateAll(IVsPackageManager activePackageManager, IProjectManager projectManager)
 {
     var resolver = new ActionResolver()
     {
         Logger = this,
         AllowPrereleaseVersions = IncludePrerelease,
         DependencyVersion = activePackageManager.DependencyVersion
     };
     var allPackages = SelectedNode.GetPackages(String.Empty, IncludePrerelease);
     foreach (var package in allPackages)
     {
         resolver.AddOperation(PackageAction.Install, package, projectManager);
     }
     var actions = resolver.ResolveActions();
     return actions;
 }
开发者ID:rikoe,项目名称:nuget,代码行数:16,代码来源:UpdatesProvider.cs


示例16: 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


示例17: GetAllPackageReferences

        /// <summary>
        /// Gets all package references in all projects of the current solution plus package 
        /// references specified in the solution packages.config
        /// </summary>
        private IEnumerable<PackageReference> GetAllPackageReferences(IVsPackageManager packageManager)
        {
            IEnumerable<PackageReference> projectReferences = from project in _solutionManager.GetProjects()
                                                              from reference in GetPackageReferences(packageManager.GetProjectManager(project))
                                                              select reference;

            var localRepository = packageManager.LocalRepository as SharedPackageRepository;
            if (localRepository != null)
            {
                IEnumerable<PackageReference> solutionReferences = localRepository.PackageReferenceFile.GetPackageReferences();
                return projectReferences.Concat(solutionReferences).Distinct();
            }

            return projectReferences.Distinct();
        }
开发者ID:Mailaender,项目名称:xamarin-nuget,代码行数:19,代码来源:PackageRestoreManager.cs


示例18: 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


示例19: CreateInstalledProvider

        private static InstalledProvider CreateInstalledProvider(
            IVsPackageManager packageManager = null,
            IProjectManager projectManager = null,
            Project project = null,
            IScriptExecutor scriptExecutor = null)
        {
            if (packageManager == null) {
                packageManager = new Mock<IVsPackageManager>().Object;
            }

            if (projectManager == null) {
                projectManager = new Mock<IProjectManager>().Object;
            }

            var mockProgressWindowOpener = new Mock<IProgressWindowOpener>();

            if (project == null) {
                project = new Mock<Project>().Object;
            }

            if (scriptExecutor == null) {
                scriptExecutor = new Mock<IScriptExecutor>().Object;
            }

            var services = new ProviderServices(
                null,
                mockProgressWindowOpener.Object,
                scriptExecutor,
                new MockOutputConsoleProvider()
            );

            return new InstalledProvider(packageManager, project, projectManager, new System.Windows.ResourceDictionary(), services, new Mock<IProgressProvider>().Object);
        }
开发者ID:grendello,项目名称:nuget,代码行数:33,代码来源:InstalledProviderTest.cs


示例20: CheckPSScriptAndShowLicenseAgreement

        protected bool CheckPSScriptAndShowLicenseAgreement(
            PackageItem item, IList<Project> projects, IVsPackageManager packageManager, out IList<PackageOperation> operations)
        {
            ShowProgressWindow();

            // combine the operations of all selected project
            var allOperations = new List<PackageOperation>();
            foreach (Project project in projects)
            {
                IProjectManager projectManager = packageManager.GetProjectManager(project);

                IList<PackageOperation> projectOperations;
                CheckInstallPSScripts(
                    item.PackageIdentity,
                    projectManager.LocalRepository,
                    packageManager.SourceRepository,
                    project.GetTargetFrameworkName(),
                    IncludePrerelease,
                    out projectOperations);

                allOperations.AddRange(projectOperations);
            }

            // reduce the operations before checking for license agreements
            operations = allOperations.Reduce();

            return ShowLicenseAgreement(packageManager, operations);
        }
开发者ID:themotleyfool,项目名称:NuGet,代码行数:28,代码来源:SolutionOnlineProvider.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVsPackageManagerFactory类代码示例发布时间:2022-05-24
下一篇:
C# IVsOutputWindowPane类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap