public VsMSBuildProjectSystemServices(
            IVsProjectAdapter vsProjectAdapter,
            VsMSBuildProjectSystem vsProjectSystem,
            IVsProjectThreadingService threadingService,
            Lazy <IScriptExecutor> scriptExecutor)
        {
            Assumes.Present(vsProjectAdapter);
            Assumes.Present(vsProjectSystem);
            Assumes.Present(threadingService);
            Assumes.Present(scriptExecutor);

            _vsProjectAdapter = vsProjectAdapter;
            _vsProjectSystem  = vsProjectSystem;
            _threadingService = threadingService;

            if (vsProjectSystem is NativeProjectSystem)
            {
                ReferencesReader = new NativeProjectSystemReferencesReader(vsProjectAdapter, _threadingService);
            }
            else if (vsProjectSystem is CpsProjectSystem)
            {
                ReferencesReader = new CpsProjectSystemReferenceReader(vsProjectAdapter, _threadingService);
            }
            else
            {
                ReferencesReader = new VsCoreProjectSystemReferenceReader(vsProjectAdapter, _threadingService);
            }
            ScriptService = new VsProjectScriptHostService(vsProjectAdapter, scriptExecutor);
        }
        private VsPackageRestorer CreateTarget(
            ISettings settings = null,
            ISolutionManager solutionManager            = null,
            IPackageRestoreManager restoreManager       = null,
            IVsProjectThreadingService threadingService = null,
            INuGetTelemetryProvider telemetryProvider   = null)
        {
            if (settings == null)
            {
                settings = new Mock <ISettings>().Object;
            }

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

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

            if (threadingService == null)
            {
                threadingService = new TestProjectThreadingService();
            }

            if (telemetryProvider == null)
            {
                // Use strict mode, as known/expected errors should not post faults.
                telemetryProvider = new Mock <INuGetTelemetryProvider>(MockBehavior.Strict).Object;
            }

            return(new VsPackageRestorer(settings, solutionManager, restoreManager, threadingService, telemetryProvider));
        }
        public LegacyPackageReferenceProject(
            IVsProjectAdapter vsProjectAdapter,
            string projectId,
            INuGetProjectServices projectServices,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsProjectAdapter);
            Assumes.NotNullOrEmpty(projectId);
            Assumes.Present(projectServices);
            Assumes.Present(threadingService);

            _vsProjectAdapter = vsProjectAdapter;
            _threadingService = threadingService;

            _projectName       = _vsProjectAdapter.ProjectName;
            _projectUniqueName = _vsProjectAdapter.UniqueName;
            _projectFullPath   = _vsProjectAdapter.FullProjectPath;

            ProjectStyle = ProjectStyle.PackageReference;

            InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName);
            InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _projectUniqueName);
            InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, _projectFullPath);
            InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId);

            ProjectServices = projectServices;
        }
Ejemplo n.º 4
0
 public LegacyPackageReferenceProjectProvider(
     Lazy <IDeferredProjectWorkspaceService> workspaceService,
     IVsProjectThreadingService threadingService)
     : this(AsyncServiceProvider.GlobalProvider,
            workspaceService,
            threadingService)
 {
 }
Ejemplo n.º 5
0
 public LegacyPackageReferenceProjectProvider(
     IVsProjectThreadingService threadingService,
     Lazy <IScriptExecutor> scriptExecutor)
     : this(AsyncServiceProvider.GlobalProvider,
            threadingService,
            scriptExecutor)
 {
 }
Ejemplo n.º 6
0
 public VsProjectAdapterProvider(
     [Import(typeof(SAsyncServiceProvider))]
     IAsyncServiceProvider serviceProvider,
     IVsProjectThreadingService threadingService)
     : this(
         threadingService,
         new AsyncLazy <SVsSolution>(() => serviceProvider.GetServiceAsync <SVsSolution, SVsSolution>(throwOnFailure : false), threadingService.JoinableTaskFactory))
 {
 }
 public VsProjectAdapterProvider(
     [Import(typeof(SAsyncServiceProvider))]
     IAsyncServiceProvider serviceProvider,
     IVsProjectThreadingService threadingService)
     : this(
         threadingService,
         new AsyncLazy <IDeferredProjectWorkspaceService>(() => serviceProvider.GetServiceAsync <IDeferredProjectWorkspaceService>(), threadingService.JoinableTaskFactory),
         new AsyncLazy <IVsSolution5>(() => serviceProvider.GetServiceAsync <SVsSolution, IVsSolution5>(), threadingService.JoinableTaskFactory))
 {
 }
        public VsCoreProjectBuildProperties(
            EnvDTE.Project project,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(project);
            Assumes.Present(threadingService);

            _project          = project;
            _threadingService = threadingService;
        }
        public VsManagedLanguagesProjectBuildProperties(
            IVsBuildPropertyStorage propertyStorage,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(propertyStorage);
            Assumes.Present(threadingService);

            _propertyStorage  = propertyStorage;
            _threadingService = threadingService;
        }
Ejemplo n.º 10
0
        internal VsProjectAdapterProvider(
            IVsProjectThreadingService threadingService,
            AsyncLazy <SVsSolution> vsSolution)
        {
            Assumes.Present(threadingService);
            Assumes.Present(vsSolution);

            _threadingService = threadingService;
            _vsSolution       = vsSolution;
        }
        public MSBuildNuGetProjectProvider(
            IAsyncServiceProvider vsServiceProvider,
            IVsProjectThreadingService threadingService,
            Lazy <IScriptExecutor> scriptExecutor)
        {
            Assumes.Present(vsServiceProvider);
            Assumes.Present(threadingService);
            Assumes.Present(scriptExecutor);

            _threadingService = threadingService;
            _scriptExecutor   = scriptExecutor;
        }
Ejemplo n.º 12
0
        public LegacyPackageReferenceProjectProvider(
            IAsyncServiceProvider vsServiceProvider,
            IVsProjectThreadingService threadingService,
            Lazy <IScriptExecutor> scriptExecutor)
        {
            Assumes.Present(vsServiceProvider);
            Assumes.Present(threadingService);
            Assumes.Present(scriptExecutor);

            _threadingService = threadingService;
            _scriptExecutor   = scriptExecutor;
        }
Ejemplo n.º 13
0
        public VsCoreProjectSystemReferenceReader(
            IVsProjectAdapter vsProjectAdapter,
            INuGetProjectServices projectServices)
        {
            Assumes.Present(vsProjectAdapter);
            Assumes.Present(projectServices);

            _vsProjectAdapter = vsProjectAdapter;

            _threadingService = projectServices.GetGlobalService <IVsProjectThreadingService>();
            Assumes.Present(_threadingService);
        }
Ejemplo n.º 14
0
        public VsCoreProjectSystemReferenceReader(
            IVsProjectAdapter vsProjectAdapter,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsProjectAdapter);
            Assumes.Present(threadingService);

            _vsProjectAdapter = vsProjectAdapter;
            _threadingService = threadingService;

            _referenceMetadata = new string[] { "ReferenceOutputAssembly" };
        }
Ejemplo n.º 15
0
        public VsProjectBuildProperties(
            Lazy <Project> project,
            IVsBuildPropertyStorage propertyStorage,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(project);
            Assumes.Present(threadingService);

            _dteProject       = project;
            _propertyStorage  = propertyStorage;
            _threadingService = threadingService;
        }
        internal VsProjectAdapterProvider(
            IVsProjectThreadingService threadingService,
            AsyncLazy <IDeferredProjectWorkspaceService> workspaceService,
            AsyncLazy <IVsSolution5> vsSolution5)
        {
            Assumes.Present(threadingService);
            Assumes.Present(workspaceService);
            Assumes.Present(vsSolution5);

            _threadingService = threadingService;
            _workspaceService = workspaceService;
            _vsSolution5      = vsSolution5;
        }
Ejemplo n.º 17
0
 public VsPackageRestorer(
     Configuration.ISettings settings,
     ISolutionManager solutionManager,
     IPackageRestoreManager restoreManager,
     IVsProjectThreadingService threadingService,
     INuGetTelemetryProvider telemetryProvider)
 {
     _settings          = settings;
     _solutionManager   = solutionManager;
     _restoreManager    = restoreManager;
     _threadingService  = threadingService;
     _telemetryProvider = telemetryProvider;
 }
        public MSBuildNuGetProjectProvider(
            [Import(typeof(SVsServiceProvider))]
            IServiceProvider vsServiceProvider,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsServiceProvider);
            Assumes.Present(threadingService);

            _threadingService = threadingService;

            _componentModel = new Lazy <IComponentModel>(
                () => vsServiceProvider.GetService <SComponentModel, IComponentModel>());
        }
Ejemplo n.º 19
0
        public VsProjectAdapterProvider(
            [Import(typeof(SVsServiceProvider))]
            IServiceProvider serviceProvider,
            Lazy <IDeferredProjectWorkspaceService> workspaceService,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(serviceProvider);
            Assumes.Present(threadingService);
            Assumes.Present(workspaceService);

            _workspaceService = workspaceService;
            _threadingService = threadingService;
            _vsSolution       = new Lazy <IVsSolution>(() => serviceProvider.GetService <SVsSolution, IVsSolution>());
        }
Ejemplo n.º 20
0
 public LegacyPackageReferenceProject(
     IVsProjectAdapter vsProjectAdapter,
     string projectId,
     INuGetProjectServices projectServices,
     IVsProjectThreadingService threadingService,
     NuGetFramework targetFramework)
     : this(vsProjectAdapter,
            projectId,
            projectServices,
            threadingService)
 {
     Assumes.NotNull(targetFramework);
     TargetFramework = targetFramework;
 }
 public VsPackageInstallerServices(
     IVsSolutionManager solutionManager,
     ISourceRepositoryProvider sourceRepositoryProvider,
     ISettings settings,
     IDeleteOnRestartManager deleteOnRestartManager,
     IVsProjectThreadingService threadingService,
     INuGetTelemetryProvider telemetryProvider)
 {
     _solutionManager          = solutionManager;
     _sourceRepositoryProvider = sourceRepositoryProvider;
     _deleteOnRestartManager   = deleteOnRestartManager;
     _settings          = settings;
     _threadingService  = threadingService;
     _telemetryProvider = telemetryProvider;
 }
        public NativeProjectSystemReferencesReader(
            IVsProjectAdapter vsProjectAdapter,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsProjectAdapter);
            Assumes.Present(threadingService);

            _vsProjectAdapter = vsProjectAdapter;
            _threadingService = threadingService;
            _vcProject        = new AsyncLazy <VCProject>(async() =>
            {
                await threadingService.JoinableTaskFactory.SwitchToMainThreadAsync();
                return(_vsProjectAdapter.Project.Object as VCProject);
            }, threadingService.JoinableTaskFactory);
        }
Ejemplo n.º 23
0
        public VsCoreProjectSystemServices(
            IVsProjectAdapter vsProjectAdapter,
            IComponentModel componentModel)
            : base(componentModel)
        {
            Assumes.Present(vsProjectAdapter);

            _vsProjectAdapter = vsProjectAdapter;

            _threadingService = GetGlobalService <IVsProjectThreadingService>();
            Assumes.Present(_threadingService);

            ReferencesReader = new VsCoreProjectSystemReferenceReader(vsProjectAdapter, this);
            ScriptService    = new VsProjectScriptHostService(vsProjectAdapter, this);
        }
Ejemplo n.º 24
0
        public VsCoreProjectSystemServices(
            IVsProjectAdapter vsProjectAdapter,
            IVsProjectThreadingService threadingService,
            Lazy <IScriptExecutor> _scriptExecutor)
        {
            Assumes.Present(vsProjectAdapter);
            Assumes.Present(threadingService);

            _vsProjectAdapter = vsProjectAdapter;
            _threadingService = threadingService;

            ProjectSystem    = new VsCoreProjectSystem(_vsProjectAdapter);
            ReferencesReader = new VsCoreProjectSystemReferenceReader(vsProjectAdapter, threadingService);
            ScriptService    = new VsProjectScriptHostService(vsProjectAdapter, _scriptExecutor);
        }
Ejemplo n.º 25
0
        public WorkspaceProjectBuildProperties(
            string fullProjectPath,
            IDeferredProjectWorkspaceService workspaceService,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(workspaceService);
            Assumes.Present(threadingService);

            _workspaceService = workspaceService;
            _threadingService = threadingService;
            _fullProjectPath  = fullProjectPath;

            _buildProjectDataService = new AsyncLazy <IMSBuildProjectDataService>(
                () => workspaceService.GetMSBuildProjectDataServiceAsync(_fullProjectPath),
                threadingService.JoinableTaskFactory);
        }
        public ProjectJsonProjectProvider(
            IAsyncServiceProvider vsServiceProvider,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsServiceProvider);
            Assumes.Present(threadingService);

            _threadingService = threadingService;

            _componentModel = new AsyncLazy <IComponentModel>(
                async() =>
            {
                return(await vsServiceProvider.GetServiceAsync <SComponentModel, IComponentModel>());
            },
                _threadingService.JoinableTaskFactory);
        }
        public VsManagedLanguagesProjectSystemServices(
            IVsProjectAdapter vsProjectAdapter,
            IComponentModel componentModel)
            : base(componentModel)
        {
            Assumes.Present(vsProjectAdapter);

            _vsProjectAdapter = vsProjectAdapter;

            _threadingService = GetGlobalService <IVsProjectThreadingService>();
            Assumes.Present(_threadingService);

            _asVSProject4 = new Lazy <VSProject4>(() => vsProjectAdapter.Project.Object as VSProject4);

            ScriptService = new VsProjectScriptHostService(vsProjectAdapter, this);
        }
Ejemplo n.º 28
0
        public VsProjectAdapter(
            VsHierarchyItem vsHierarchyItem,
            ProjectNames projectNames,
            string fullProjectPath,
            Func <IVsHierarchy, EnvDTE.Project> loadDteProject,
            IProjectBuildProperties buildProperties,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsHierarchyItem);

            _vsHierarchyItem  = vsHierarchyItem;
            _dteProject       = new Lazy <EnvDTE.Project>(() => loadDteProject(_vsHierarchyItem.VsHierarchy));
            _threadingService = threadingService;
            FullProjectPath   = fullProjectPath;
            ProjectNames      = projectNames;
            BuildProperties   = buildProperties;
        }
        public LegacyPackageReferenceProjectProvider(
            [Import(typeof(SVsServiceProvider))]
            IServiceProvider vsServiceProvider,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsServiceProvider);
            Assumes.Present(threadingService);

            _threadingService = threadingService;

            _componentModel = new AsyncLazy <IComponentModel>(
                async() =>
            {
                await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync();
                return(vsServiceProvider.GetService <SComponentModel, IComponentModel>());
            },
                _threadingService.JoinableTaskFactory);
        }
Ejemplo n.º 30
0
        public LegacyPackageReferenceProjectProvider(
            IAsyncServiceProvider vsServiceProvider,
            Lazy <IDeferredProjectWorkspaceService> workspaceService,
            IVsProjectThreadingService threadingService)
        {
            Assumes.Present(vsServiceProvider);
            Assumes.Present(workspaceService);
            Assumes.Present(threadingService);

            _workspaceService = workspaceService;
            _threadingService = threadingService;

            _componentModel = new AsyncLazy <IComponentModel>(
                async() =>
            {
                return(await vsServiceProvider.GetServiceAsync <SComponentModel, IComponentModel>());
            },
                _threadingService.JoinableTaskFactory);
        }