private static bool TryGetProjectServices(EnvDTE.Project project, out IUnconfiguredProjectServices unconfiguredProjectServices, out IProjectServices projectServices)
        {
            IVsBrowseObjectContext context = project as IVsBrowseObjectContext;

            if (context == null && project != null)
            {
                // VC implements this on their DTE.Project.Object
                context = project.Object as IVsBrowseObjectContext;
            }

            if (context == null)
            {
                unconfiguredProjectServices = null;
                projectServices             = null;

                return(false);
            }
            else
            {
                UnconfiguredProject unconfiguredProject = context.UnconfiguredProject;

                // VS2017 returns the interface types of the services classes but VS2019 returns the classes directly.
                // Hence, we need to obtain the object via reflection to avoid MissingMethodExceptions.
                object services    = typeof(UnconfiguredProject).GetProperty("Services").GetValue(unconfiguredProject);
                object prjServices = typeof(IProjectService).GetProperty("Services").GetValue(unconfiguredProject.ProjectService);

                unconfiguredProjectServices = services as IUnconfiguredProjectServices;
                projectServices             = prjServices as IProjectServices;

                return(unconfiguredProjectServices != null && project != null);
            }
        }
        public ActiveConfiguredProjectsProvider(IUnconfiguredProjectServices services, UnconfiguredProject project)
        {
            _services = services;
            _project  = project;

            DimensionProviders = new OrderPrecedenceImportCollection <IActiveConfiguredProjectsDimensionProvider>(projectCapabilityCheckProvider: project);
        }
Example #3
0
        public ActiveConfiguredProjectsProvider(IUnconfiguredProjectServices services, IUnconfiguredProjectCommonServices commonServices)
        {
            Requires.NotNull(services, nameof(services));
            Requires.NotNull(commonServices, nameof(commonServices));

            _services       = services;
            _commonServices = commonServices;
        }
Example #4
0
 public DesignTimeInputsDataSource(UnconfiguredProject project,
                                   IUnconfiguredProjectServices unconfiguredProjectServices,
                                   IActiveConfiguredProjectSubscriptionService projectSubscriptionService)
     : base(unconfiguredProjectServices, synchronousDisposal: true, registerDataSource: false)
 {
     _project = project;
     _projectSubscriptionService = projectSubscriptionService;
 }
        public ActiveConfiguredProjectsProvider(IUnconfiguredProjectServices services, UnconfiguredProject project)
        {
            Requires.NotNull(services, nameof(services));
            Requires.NotNull(project, nameof(project));

            _services = services;
            _project  = project;

            DimensionProviders = new OrderPrecedenceImportCollection <IActiveConfiguredProjectsDimensionProvider>(projectCapabilityCheckProvider: project);
        }
        public ActiveConfiguredProjectsProvider(IUnconfiguredProjectServices services, IUnconfiguredProjectCommonServices commonServices)
        {
            Requires.NotNull(services, nameof(services));
            Requires.NotNull(commonServices, nameof(commonServices));

            _services       = services;
            _commonServices = commonServices;

            DimensionProviders = new OrderPrecedenceImportCollection <IActiveConfiguredProjectsDimensionProvider>(projectCapabilityCheckProvider: commonServices.Project);
        }
Example #7
0
 public DesignTimeInputsFileWatcher(UnconfiguredProject project,
                                    IUnconfiguredProjectServices unconfiguredProjectServices,
                                    IProjectThreadingService threadingService,
                                    IDesignTimeInputsDataSource designTimeInputsDataSource,
                                    IVsService <SVsFileChangeEx, IVsAsyncFileChangeEx> fileChangeService)
     : base(unconfiguredProjectServices, synchronousDisposal: false, registerDataSource: false)
 {
     _threadingService           = threadingService;
     _designTimeInputsDataSource = designTimeInputsDataSource;
     _fileChangeService          = fileChangeService;
 }
Example #8
0
 // ECan pass null for all and a default will be crewated
 public LaunchSettingsUnderTest(UnconfiguredProject project, IUnconfiguredProjectServices projectServices,
                                IFileSystem fileSystem, IUnconfiguredProjectCommonServices commonProjectServices,
                                IActiveConfiguredProjectSubscriptionService projectSubscriptionService, ActiveConfiguredProject <AppDesignerFolderSpecialFileProvider> appDesignerFolderSpecialFileProvider)
     : base(project, projectServices, fileSystem, commonProjectServices, projectSubscriptionService, appDesignerFolderSpecialFileProvider)
 {
     // Block the code from setting up one on the real file system. Since we block, it we need to set up the fileChange scheduler manually
     FileWatcher = new SimpleFileWatcher();
     // Make the unit tests run faster
     FileChangeProcessingDelay = TimeSpan.FromMilliseconds(50);
     FileChangeScheduler       = new TaskDelayScheduler(FileChangeProcessingDelay, commonProjectServices.ThreadingService,
                                                        CancellationToken.None);
 }
Example #9
0
        public LaunchSettingsProvider(UnconfiguredProject unconfiguredProject, IUnconfiguredProjectServices projectServices,
                                      IFileSystem fileSystem, IUnconfiguredProjectCommonServices commonProjectServices,
                                      IActiveConfiguredProjectSubscriptionService projectSubscriptionService)
        {
            ProjectServices            = projectServices;
            FileManager                = fileSystem;
            CommonProjectServices      = commonProjectServices;
            JsonSerializationProviders = new OrderPrecedenceImportCollection <ILaunchSettingsSerializationProvider, IJsonSection>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst,
                                                                                                                                  unconfiguredProject);
            SourceControlIntegrations = new OrderPrecedenceImportCollection <ISourceCodeControlIntegration>(projectCapabilityCheckProvider: unconfiguredProject);

            ProjectSubscriptionService = projectSubscriptionService;
        }
Example #10
0
 public DesignTimeInputsChangeTracker(UnconfiguredProject project,
                                      IUnconfiguredProjectServices unconfiguredProjectServices,
                                      IProjectThreadingService threadingService,
                                      IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
                                      IDesignTimeInputsDataSource inputsDataSource,
                                      IDesignTimeInputsFileWatcher fileWatcher)
     : base(unconfiguredProjectServices, synchronousDisposal: true, registerDataSource: false)
 {
     _project = project;
     _projectSubscriptionService = projectSubscriptionService;
     _inputsDataSource           = inputsDataSource;
     _fileWatcher = fileWatcher;
 }
Example #11
0
 public LaunchSettingsProvider(UnconfiguredProject unconfiguredProject, IUnconfiguredProjectServices projectServices,
                               IFileSystem fileSystem, IUnconfiguredProjectCommonServices commonProjectServices,
                               IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
                               [Import(AllowDefault = true)] Lazy <ISourceCodeControlIntegration> sourceControlIntegration)
 {
     SourceControlIntegration = sourceControlIntegration;
     ProjectServices          = projectServices;
     FileManager                = fileSystem;
     CommonProjectServices      = commonProjectServices;
     JsonSerializationProviders = new OrderPrecedenceImportCollection <ILaunchSettingsSerializationProvider, IJsonSection>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst,
                                                                                                                           unconfiguredProject);;
     ProjectSubscriptionService = projectSubscriptionService;
 }
        public LaunchSettingsProvider(UnconfiguredProject project, IUnconfiguredProjectServices projectServices,
                                      IFileSystem fileSystem, IUnconfiguredProjectCommonServices commonProjectServices,
                                      IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
                                      ActiveConfiguredProject <AppDesignerFolderSpecialFileProvider> appDesignerSpecialFileProvider)
        {
            ProjectServices            = projectServices;
            FileManager                = fileSystem;
            CommonProjectServices      = commonProjectServices;
            JsonSerializationProviders = new OrderPrecedenceImportCollection <ILaunchSettingsSerializationProvider, IJsonSection>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst,
                                                                                                                                  project);
            SourceControlIntegrations = new OrderPrecedenceImportCollection <ISourceCodeControlIntegration>(projectCapabilityCheckProvider: project);

            ProjectSubscriptionService      = projectSubscriptionService;
            _appDesignerSpecialFileProvider = appDesignerSpecialFileProvider;
            _launchSettingsFilePath         = new AsyncLazy <string>(GetLaunchSettingsFilePathNoCacheAsync, commonProjectServices.ThreadingService.JoinableTaskFactory);
        }
Example #13
0
        private ActiveConfiguredProjectsProvider CreateInstance(IUnconfiguredProjectServices services = null, UnconfiguredProject project = null, IEnumerable <IActiveConfiguredProjectsDimensionProvider> dimensionProviders = null)
        {
            services = services ?? IUnconfiguredProjectServicesFactory.Create();
            project  = project ?? UnconfiguredProjectFactory.Create();

            var provider = new ActiveConfiguredProjectsProvider(services, project);

            if (dimensionProviders != null)
            {
                foreach (var dimensionProvider in dimensionProviders)
                {
                    provider.DimensionProviders.Add(dimensionProvider, appliesTo: ProjectCapability.AlwaysAvailable);
                }
            }

            return(provider);
        }