public NuGetPackageLicenseAuditor (
			IEnumerable<SourceRepository> sources,
			INuGetPackageManager packageManager,
			ILicenseAcceptanceService licenseAcceptanceService)
		{
			this.sources = sources.ToList ();
			this.packageManager = packageManager;
			this.licenseAcceptanceService = licenseAcceptanceService;
		}
		public NuGetPackageLicenseAuditor (
			IEnumerable<SourceRepository> sources,
			INuGetPackageManager packageManager)
			: this (
				sources,
				packageManager,
				new LicenseAcceptanceService ())
		{
		}
		public static Task AcceptLicenses (
			IEnumerable<SourceRepository> sources,
			IEnumerable<NuGetProjectAction> actions,
			INuGetPackageManager packageManager,
			ILicenseAcceptanceService licenseAcceptanceService,
			CancellationToken cancellationToken)
		{
			var auditor = new NuGetPackageLicenseAuditor (sources, packageManager, licenseAcceptanceService);
			return auditor.AcceptLicenses (actions, cancellationToken);
		}
Ejemplo n.º 4
0
		public AddInSetup(IAddInManagerEvents events, INuGetPackageManager nuGet, ISDAddInManagement sdAddInManagement)
		{
			_events = events;
			_nuGet = nuGet;
			_sdAddInManagement = sdAddInManagement;
			
			_addInsMarkedForInstall = new List<ManagedAddIn>();
			_nuGetToAddInMappings = new Dictionary<string, string>();
			
			// Register event handlers
			_events.AddInPackageDownloaded += events_AddInPackageDownloaded;
		}
        public ProjectKNuGetProject(INuGetPackageManager project, string projectName, string uniqueName)
        {
            _project = project;
            InternalMetadata.Add(NuGetProjectMetadataKeys.Name, projectName);
            InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, uniqueName);

            var supportedFrameworks = _project.GetSupportedFrameworksAsync(CancellationToken.None)
                .Result
                .Select(f => NuGetFramework.Parse(f.FullName));

            InternalMetadata.Add(NuGetProjectMetadataKeys.SupportedFrameworks, supportedFrameworks);
        }
Ejemplo n.º 6
0
        public LocalPackagesLoaderService(IDirectoryService directoryService, IRepositoryContextService repositoryService, IExtensibleProjectLocator extensibleProjectLocator,
                                          INuGetPackageManager nuGetExtensibleProjectManager, ISourceRepositoryProvider repositoryProvider)
        {
            Argument.IsNotNull(() => directoryService);
            Argument.IsNotNull(() => extensibleProjectLocator);
            Argument.IsNotNull(() => nuGetExtensibleProjectManager);
            Argument.IsNotNull(() => repositoryService);

            _extensibleProjectLocator = extensibleProjectLocator;
            _projectManager           = nuGetExtensibleProjectManager;
            _repositoryProvider       = repositoryProvider;
            _directoryService         = directoryService;
            _repositoryService        = repositoryService;
        }
Ejemplo n.º 7
0
        public UninstallNuGetPackageAction(
            IMonoDevelopSolutionManager solutionManager,
            IDotNetProject dotNetProject,
            INuGetProjectContext projectContext,
            INuGetPackageManager packageManager,
            IPackageManagementEvents packageManagementEvents)
        {
            this.dotNetProject           = dotNetProject;
            this.context                 = projectContext;
            this.packageManager          = packageManager;
            this.packageManagementEvents = packageManagementEvents;

            project = solutionManager.GetNuGetProject(dotNetProject);
        }
		public UninstallNuGetPackageAction (
			IMonoDevelopSolutionManager solutionManager,
			IDotNetProject dotNetProject,
			INuGetProjectContext projectContext,
			INuGetPackageManager packageManager,
			IPackageManagementEvents packageManagementEvents)
		{
			this.dotNetProject = dotNetProject;
			this.context = projectContext;
			this.packageManager = packageManager;
			this.packageManagementEvents = packageManagementEvents;

			project = solutionManager.GetNuGetProject (dotNetProject);
		}
Ejemplo n.º 9
0
        public ProjectKNuGetProject(INuGetPackageManager project, string projectName, string uniqueName, string projectId)
        {
            _project = project;
            InternalMetadata.Add(NuGetProjectMetadataKeys.Name, projectName);
            InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, uniqueName);
            InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId);

            NuGetUIThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                var frameworks          = await _project.GetSupportedFrameworksAsync(CancellationToken.None);
                var supportedFrameworks = frameworks.Select(f => NuGetFramework.Parse(f.FullName));

                InternalMetadata.Add(NuGetProjectMetadataKeys.SupportedFrameworks, supportedFrameworks);
            });
        }
        public UpdatePackagesLoaderService(IRepositoryService repositoryService, IExtensibleProjectLocator extensibleProjectLocator,
                                           INuGetPackageManager nuGetExtensibleProjectManager)
        {
            Argument.IsNotNull(() => repositoryService);
            Argument.IsNotNull(() => extensibleProjectLocator);
            Argument.IsNotNull(() => nuGetExtensibleProjectManager);

            _repositoryService             = repositoryService;
            _extensibleProjectLocator      = extensibleProjectLocator;
            _nuGetExtensibleProjectManager = nuGetExtensibleProjectManager;

            _serviceLocator = this.GetServiceLocator();

            _feedRepositoryLoader    = new Lazy <IPackageLoaderService>(() => _serviceLocator.ResolveType <IPackageLoaderService>());
            _projectRepositoryLoader = new Lazy <IPackageLoaderService>(() => _serviceLocator.ResolveType <IPackageLoaderService>("Installed"));
        }
        public UpdateMultipleNuGetPackagesAction(
            IEnumerable <SourceRepository> primarySources,
            IMonoDevelopSolutionManager solutionManager,
            INuGetProjectContext context,
            INuGetPackageManager packageManager,
            IPackageRestoreManager restoreManager,
            IPackageManagementEvents packageManagementEvents)
        {
            this.solutionManager         = solutionManager;
            this.context                 = context;
            this.packageManager          = packageManager;
            this.restoreManager          = restoreManager;
            this.packageManagementEvents = packageManagementEvents;

            this.primarySources = primarySources.ToList();
            secondarySources    = solutionManager.CreateSourceRepositoryProvider().GetRepositories().ToList();
        }
		public UpdateNuGetPackageAction (
			IMonoDevelopSolutionManager solutionManager,
			IDotNetProject dotNetProject,
			INuGetProjectContext projectContext,
			INuGetPackageManager packageManager,
			IPackageManagementEvents packageManagementEvents)
		{
			this.dotNetProject = dotNetProject;
			this.context = projectContext;
			this.packageManager = packageManager;
			this.packageManagementEvents = packageManagementEvents;

			project = solutionManager.GetNuGetProject (dotNetProject);

			sourceRepositoryProvider = solutionManager.CreateSourceRepositoryProvider ();
			primarySources = sourceRepositoryProvider.GetRepositories ().ToList ();
		}
Ejemplo n.º 13
0
        public UpdateNuGetPackageAction(
            IMonoDevelopSolutionManager solutionManager,
            IDotNetProject dotNetProject,
            INuGetProjectContext projectContext,
            INuGetPackageManager packageManager,
            IPackageManagementEvents packageManagementEvents)
        {
            this.dotNetProject           = dotNetProject;
            this.context                 = projectContext;
            this.packageManager          = packageManager;
            this.packageManagementEvents = packageManagementEvents;

            project = solutionManager.GetNuGetProject(dotNetProject);

            sourceRepositoryProvider = solutionManager.CreateSourceRepositoryProvider();
            primarySources           = sourceRepositoryProvider.GetRepositories().ToList();
        }
Ejemplo n.º 14
0
        public DeletemeWatcher(IPackageOperationNotificationService packageOperationNotificationService, IFileSystemService fileSystemService,
                               IDirectoryService directoryService, INuGetPackageManager nuGetPackageManager, IDefaultExtensibleProjectProvider projectProvider, IMessageMediator messageMediator)
            : base(packageOperationNotificationService)
        {
            Argument.IsNotNull(() => fileSystemService);
            Argument.IsNotNull(() => directoryService);
            Argument.IsNotNull(() => nuGetPackageManager);
            Argument.IsNotNull(() => projectProvider);
            Argument.IsNotNull(() => messageMediator);

            _fileSystemService   = fileSystemService;
            _directoryService    = directoryService;
            _nuGetPackageManager = nuGetPackageManager;

            messageMediator.Register <PackagingDeletemeMessage>(this, OnDeletemeMessageAsync);

            _defaultProject = projectProvider.GetDefaultProject();
        }
Ejemplo n.º 15
0
        private void AddPackageReferenceToNuGetAwareProject(IPackage package)
        {
            INuGetPackageManager        project = this.Project as INuGetPackageManager;
            Dictionary <string, object> options = new Dictionary <string, object>();

            using (CancellationTokenSource source = new CancellationTokenSource())
            {
                IEnumerable <FrameworkName>         packageSupportedFrameworks = package.GetSupportedFrameworks();
                IReadOnlyCollection <FrameworkName> result = project.GetSupportedFrameworksAsync(source.Token).Result;
                options["Frameworks"] = (from projectFramework in result
                                         where VersionUtility.IsCompatible(projectFramework, packageSupportedFrameworks)
                                         select projectFramework).ToArray <FrameworkName>();
                NuGetPackageMoniker moniker1 = new NuGetPackageMoniker();
                moniker1.Id      = package.Id;
                moniker1.Version = package.Version.ToString();
                project.InstallPackageAsync(moniker1, options, null, null, source.Token).Wait();
            }
        }
        public V3RestorePackageConfigAndReinstall(IDefaultExtensibleProjectProvider projectProvider, INuGetPackageManager nuGetPackageManager, IRepositoryContextService repositoryContextService,
                                                  ILogger logger, IConfigurationService configurationService, IPackageOperationNotificationService packageOperationNotificationService, IDirectoryService directoryService)
        {
            Argument.IsNotNull(() => projectProvider);
            Argument.IsNotNull(() => nuGetPackageManager);
            Argument.IsNotNull(() => repositoryContextService);
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => packageOperationNotificationService);
            Argument.IsNotNull(() => directoryService);

            _defaultProject           = projectProvider.GetDefaultProject();
            _nuGetPackageManager      = nuGetPackageManager;
            _repositoryContextService = repositoryContextService;
            _logger = logger;
            _configurationService = configurationService;
            _packageOperationNotificationService = packageOperationNotificationService;
            _directoryService = directoryService;
        }
Ejemplo n.º 17
0
        public RepositoryService(IRepositoryContextService repositoryContextService, IExtensibleProjectLocator extensibleProjectLocator,
                                 INuGetPackageManager projectManager, INuGetConfigurationService nuGetConfigurationService,
                                 IDefaultExtensibleProjectProvider defaultExtensibleProjectProvider, ISourceRepositoryProvider repositoryProvider)
        {
            Argument.IsNotNull(() => repositoryContextService);
            Argument.IsNotNull(() => extensibleProjectLocator);
            Argument.IsNotNull(() => projectManager);
            Argument.IsNotNull(() => nuGetConfigurationService);
            Argument.IsNotNull(() => defaultExtensibleProjectProvider);
            Argument.IsNotNull(() => repositoryProvider);

            _repositoryContextService         = repositoryContextService;
            _extensibleProjectLocator         = extensibleProjectLocator;
            _projectManager                   = projectManager;
            _nuGetConfigurationService        = nuGetConfigurationService;
            _defaultExtensibleProjectProvider = defaultExtensibleProjectProvider;
            _repositoryProvider               = repositoryProvider;
            LocalRepository                   = GetMainProjectRepository();
        }
Ejemplo n.º 18
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);
        }
        public InstallNuGetPackageAction(
            IEnumerable <SourceRepository> primarySources,
            IEnumerable <SourceRepository> secondarySources,
            IMonoDevelopSolutionManager solutionManager,
            IDotNetProject dotNetProject,
            INuGetProjectContext projectContext,
            INuGetPackageManager packageManager,
            IPackageManagementEvents packageManagementEvents)
        {
            this.primarySources          = primarySources.ToList();
            this.secondarySources        = secondarySources?.ToList();
            this.dotNetProject           = dotNetProject;
            this.context                 = projectContext;
            this.packageManager          = packageManager;
            this.packageManagementEvents = packageManagementEvents;

            project = solutionManager.GetNuGetProject(dotNetProject);

            LicensesMustBeAccepted      = true;
            PreserveLocalCopyReferences = true;
            OpenReadmeFile = true;
        }
Ejemplo n.º 20
0
        public PackageOperationService(IPackageOperationContextService packageOperationContextService, ILogger logger, INuGetPackageManager nuGetPackageManager,
                                       IRepositoryService repositoryService, IApiPackageRegistry apiPackageRegistry, IDefaultExtensibleProjectProvider defaultExtensibleProjectProvider,
                                       ISourceRepositoryProvider sourceRepositoryProvider, IPackageOperationNotificationService packageOperationNotificationService)
        {
            Argument.IsNotNull(() => packageOperationContextService);
            Argument.IsNotNull(() => logger);
            Argument.IsNotNull(() => nuGetPackageManager);
            Argument.IsNotNull(() => repositoryService);
            Argument.IsNotNull(() => apiPackageRegistry);
            Argument.IsNotNull(() => sourceRepositoryProvider);
            Argument.IsNotNull(() => defaultExtensibleProjectProvider);
            Argument.IsNotNull(() => packageOperationNotificationService);

            _packageOperationContextService = packageOperationContextService;
            _logger = logger;
            _nuGetPackageManager = nuGetPackageManager;
            _apiPackageRegistry  = apiPackageRegistry;
            _packageOperationNotificationService = packageOperationNotificationService;
            _defaultProject = defaultExtensibleProjectProvider.GetDefaultProject();

            // Note: this setting should be global, probably set by Resolver (which replaced the old one InstallWalker);
            DependencyVersion = DependencyBehavior.Lowest;
        }
Ejemplo n.º 21
0
        public VsProject(VsSolution solution, DteProject dteProject, IProjectManager projectManager)
            : base()
        {
            _solution = solution;
            _installed = new CoreInteropInstalledPackagesList((IPackageReferenceRepository2)projectManager.LocalRepository);
            DteProject = dteProject;

            // Add V2-related interop features
            AddFeature(() => projectManager);
            AddFeature(() => projectManager.PackageManager);
            AddFeature(() => projectManager.Project);
            AddFeature(() => projectManager.PackageManager.LocalRepository);
            AddFeature<IPackageCacheRepository>(() => MachineCache.Default);

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

            // Add PowerShell feature
            AddFeature<PowerShellScriptExecutor>(() =>
                new VsPowerShellScriptExecutor(ServiceLocator.GetInstance<IScriptExecutor>()));

#if VS14
            // Add NuGetAwareProject if the project system is nuget-aware.
            _nugetAwareProject = projectManager.Project as INuGetPackageManager;
            if (_nugetAwareProject != null)
            {
                AddFeature<NuGetAwareProject>(() => new VsNuGetAwareProject(_nugetAwareProject));
            }
#endif
        }
Ejemplo n.º 22
0
        public VsProject(VsSolution solution, DteProject dteProject, IProjectManager projectManager)
            : base()
        {
            _solution  = solution;
            _installed = new CoreInteropInstalledPackagesList((IPackageReferenceRepository2)projectManager.LocalRepository);
            DteProject = dteProject;

            // Add V2-related interop features
            AddFeature(() => projectManager);
            AddFeature(() => projectManager.PackageManager);
            AddFeature(() => projectManager.Project);
            AddFeature(() => projectManager.PackageManager.LocalRepository);
            AddFeature <IPackageCacheRepository>(() => MachineCache.Default);

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

            // Add PowerShell feature
            AddFeature <PowerShellScriptExecutor>(() =>
                                                  new VsPowerShellScriptExecutor(ServiceLocator.GetInstance <IScriptExecutor>()));

#if VS14
            // Add NuGetAwareProject if the project system is nuget-aware.
            _nugetAwareProject = projectManager.Project as INuGetPackageManager;
            if (_nugetAwareProject != null)
            {
                AddFeature <NuGetAwareProject>(() => new VsNuGetAwareProject(_nugetAwareProject));
            }
#endif
        }
Ejemplo n.º 23
0
 public VsNuGetAwareProject(INuGetPackageManager nugetAwareProject)
 {
     _nugetAwareProject = nugetAwareProject;
 }
 public NuGetAwareProjectSystem(Project project)
 {
     _project = project;
     _nugetProject = project.ToNuGetProjectSystem();
 }
 public NuGetAwareProjectPackageRepository(INuGetPackageManager project, ISharedPackageRepository sourceRepository)
 {
     _project = project;
     _repo = sourceRepository;
 }
Ejemplo n.º 26
0
 public NuGetPackageManagerImplementation(IPackageRepository sourceRepository, string path, INuGetPackageManager internalPackageManager)
     : base(sourceRepository, path)
 {
     _internalPackageManager = internalPackageManager;
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetModel"/> class.
        /// <remarks>This is internal for tests. Callers inside of the NuGet module should used NuGetDataCache::GetModel to 
        /// take advantage of cachein</remarks>
        /// </summary>
        internal NuGetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost host, FeedSource remoteSource, string destination, INuGetPackageManager packageManager, TaskScheduler scheduler)
        {
            Debug.Assert(host != null, "webMatrixHost must not be null");
            Debug.Assert(remoteSource != null, "remoteSource must not be null");
            Debug.Assert(remoteSource.SourceUrl != null, "remoteSource.SourceUrl must not be null");

            this.Descriptor = descriptor;
            this.Scheduler = scheduler;

            FeedSource = remoteSource;
            _webMatrixHost = host;
            _packageKind = descriptor.PackageKind;
            _galleryId = descriptor.GalleryId;

            this.PackageManager = packageManager;

            this.FilterManager = new FilterManager(this, this.Scheduler, descriptor);
        }
Ejemplo n.º 28
0
 public VsNuGetAwareProject(INuGetPackageManager nugetAwareProject)
 {
     _nugetAwareProject = nugetAwareProject;
 }
 public NuGetAwareProjectPackageRepository(INuGetPackageManager project, ISharedPackageRepository sourceRepository)
 {
     _project = project;
     _repo    = sourceRepository;
 }
		public InstallNuGetPackageAction (
			IEnumerable<SourceRepository> primarySources,
			IEnumerable<SourceRepository> secondarySources,
			IMonoDevelopSolutionManager solutionManager,
			IDotNetProject dotNetProject,
			INuGetProjectContext projectContext,
			INuGetPackageManager packageManager,
			IPackageManagementEvents packageManagementEvents)
		{
			this.primarySources = primarySources.ToList ();
			this.secondarySources = secondarySources?.ToList ();
			this.dotNetProject = dotNetProject;
			this.context = projectContext;
			this.packageManager = packageManager;
			this.packageManagementEvents = packageManagementEvents;

			project = solutionManager.GetNuGetProject (dotNetProject);

			LicensesMustBeAccepted = true;
			PreserveLocalCopyReferences = true;
			OpenReadmeFile = true;
		}
Ejemplo n.º 31
0
 public NuGetPackageManagerImplementation(IPackageRepository sourceRepository, string path, INuGetPackageManager internalPackageManager)
     : base(sourceRepository, path)
 {
     _internalPackageManager = internalPackageManager;
 }
        public DefferedPackageLoaderService(IRepositoryContextService repositoryService, INuGetPackageManager nuGetExtensibleProjectManager,
                                            IModelProvider <ExplorerSettingsContainer> settingsProvider, IDefaultExtensibleProjectProvider projectProvider)
        {
            Argument.IsNotNull(() => repositoryService);
            Argument.IsNotNull(() => nuGetExtensibleProjectManager);
            Argument.IsNotNull(() => settingsProvider);
            Argument.IsNotNull(() => projectProvider);

            _repositoryService = repositoryService;
            _projectManager    = nuGetExtensibleProjectManager;
            _settignsProvider  = settingsProvider;
            _projectProvider   = projectProvider;
        }
 public NuGetAwareProjectSystem(Project project)
 {
     _project      = project;
     _nugetProject = project.ToNuGetProjectSystem();
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetModel"/> class.
        /// <remarks>This is internal for tests. Callers inside of the NuGet module should used NuGetDataCache::GetModel to
        /// take advantage of cachein</remarks>
        /// </summary>
        internal NuGetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost host, FeedSource remoteSource, string destination, INuGetPackageManager packageManager, TaskScheduler scheduler)
        {
            Debug.Assert(host != null, "webMatrixHost must not be null");
            Debug.Assert(remoteSource != null, "remoteSource must not be null");
            Debug.Assert(remoteSource.SourceUrl != null, "remoteSource.SourceUrl must not be null");

            this.Descriptor = descriptor;
            this.Scheduler  = scheduler;

            FeedSource     = remoteSource;
            _webMatrixHost = host;
            _packageKind   = descriptor.PackageKind;
            _galleryId     = descriptor.GalleryId;

            this.PackageManager = packageManager;

            this.FilterManager = new FilterManager(this, this.Scheduler, descriptor);
        }
        public PageActionBarViewModel(IManagerPage managerPage, IProgressManager progressManager, INuGetPackageManager projectManager,
                                      IExtensibleProjectLocator projectLocator, IPackageCommandService packageCommandService, IPackageOperationContextService packageOperationContextService, IMessageService messageService)
        {
            Argument.IsNotNull(() => managerPage);
            Argument.IsNotNull(() => projectManager);
            Argument.IsNotNull(() => progressManager);
            Argument.IsNotNull(() => projectLocator);
            Argument.IsNotNull(() => packageCommandService);
            Argument.IsNotNull(() => packageOperationContextService);
            Argument.IsNotNull(() => messageService);

            _parentManagerPage              = managerPage;
            _projectManager                 = projectManager;
            _projectLocator                 = projectLocator;
            _progressManager                = progressManager;
            _packageCommandService          = packageCommandService;
            _packageOperationContextService = packageOperationContextService;
            _messageService                 = messageService;
            BatchUpdate  = new TaskCommand(BatchUpdateExecuteAsync, BatchUpdateCanExecute);
            BatchInstall = new TaskCommand(BatchInstallExecuteAsync, BatchInstallCanExecute);
            CheckAll     = new TaskCommand(CheckAllExecuteAsync);

            CanBatchInstall = _parentManagerPage.CanBatchInstallOperations;
            CanBatchUpdate  = _parentManagerPage.CanBatchUpdateOperations;
        }