protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            var componentModel = (IComponentModel)(await GetServiceAsync(typeof(SComponentModel)));
            Lazy <DebugFrameworksDynamicMenuCommand> debugFrameworksCmd = componentModel.DefaultExportProvider.GetExport <DebugFrameworksDynamicMenuCommand>();

            var mcs = (await GetServiceAsync(typeof(IMenuCommandService))) as OleMenuCommandService;

            mcs.AddCommand(debugFrameworksCmd.Value);

            Lazy <DebugFrameworkPropertyMenuTextUpdater> debugFrameworksMenuTextUpdater = componentModel.DefaultExportProvider.GetExport <DebugFrameworkPropertyMenuTextUpdater>();

            mcs.AddCommand(debugFrameworksMenuTextUpdater.Value);

            // Need to use the CPS export provider to get the dotnet compatibility detector
            Lazy <IProjectServiceAccessor> projectServiceAccessor = componentModel.DefaultExportProvider.GetExport <IProjectServiceAccessor>();

            _dotNetCoreCompatibilityDetector = projectServiceAccessor.Value.GetProjectService().Services.ExportProvider.GetExport <IDotNetCoreProjectCompatibilityDetector>().Value;
            await _dotNetCoreCompatibilityDetector.InitializeAsync();

#if DEBUG
            DebuggerTraceListener.RegisterTraceListener();
#endif
        }
예제 #2
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
#pragma warning disable RS0030 // Do not used banned APIs
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            _projectSelectorService = await this.GetServiceAsync <SVsRegisterProjectTypes, IVsRegisterProjectSelector>();

#pragma warning restore RS0030 // Do not used banned APIs
            Guid selectorGuid = typeof(FSharpProjectSelector).GUID;
            _projectSelectorService.RegisterProjectSelector(ref selectorGuid, new FSharpProjectSelector(), out _projectSelectorCookie);

            var componentModel = (IComponentModel)(await GetServiceAsync(typeof(SComponentModel)));
            Lazy <DebugFrameworksDynamicMenuCommand> debugFrameworksCmd = componentModel.DefaultExportProvider.GetExport <DebugFrameworksDynamicMenuCommand>();

            var mcs = (await GetServiceAsync(typeof(IMenuCommandService))) as OleMenuCommandService;
            mcs.AddCommand(debugFrameworksCmd.Value);

            Lazy <DebugFrameworkPropertyMenuTextUpdater> debugFrameworksMenuTextUpdater = componentModel.DefaultExportProvider.GetExport <DebugFrameworkPropertyMenuTextUpdater>();
            mcs.AddCommand(debugFrameworksMenuTextUpdater.Value);

            // Need to use the CPS export provider to get the dotnet compatibility detector
            Lazy <IProjectServiceAccessor> projectServiceAccessor = componentModel.DefaultExportProvider.GetExport <IProjectServiceAccessor>();
            _dotNetCoreCompatibilityDetector = projectServiceAccessor.Value.GetProjectService().Services.ExportProvider.GetExport <IDotNetCoreProjectCompatibilityDetector>().Value;
            await _dotNetCoreCompatibilityDetector.InitializeAsync();

            IVsProjectFactory factory = new XprojProjectFactory();
            factory.SetSite(new ServiceProviderToOleServiceProviderAdapter(ServiceProvider.GlobalProvider));
            RegisterProjectFactory(factory);

#if DEBUG
            DebuggerTraceListener.RegisterTraceListener();
#endif
        }
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            var componentModel = (IComponentModel)(await GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(true));
            ICompositionService compositionService = componentModel.DefaultCompositionService;
            var debugFrameworksCmd = componentModel.DefaultExportProvider.GetExport <DebugFrameworksDynamicMenuCommand>();

            var mcs = (await GetServiceAsync(typeof(IMenuCommandService)).ConfigureAwait(true)) as OleMenuCommandService;

            mcs.AddCommand(debugFrameworksCmd.Value);

            var debugFrameworksMenuTextUpdater = componentModel.DefaultExportProvider.GetExport <DebugFrameworkPropertyMenuTextUpdater>();

            mcs.AddCommand(debugFrameworksMenuTextUpdater.Value);

#if DEBUG
            DebuggerTraceListener.RegisterTraceListener();
#endif
        }