Beispiel #1
0
        private static async Task <ImplicitlyTriggeredDebugBuildManager> CreateInitializedInstanceAsync(
            Action?onImplicitBuildStart       = null,
            Action?onImplicitBuildEndOrCancel = null,
            Action <ImmutableArray <string> >?onImplicitBuildStartWithStartupPaths = null,
            bool startDebuggingBuild        = false,
            bool startWithoutDebuggingBuild = false,
            ImmutableArray <string>?startupProjectFullPaths = null)
        {
            var buildFlags = VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_NONE;

            if (startDebuggingBuild)
            {
                buildFlags |= VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_LAUNCHDEBUG;
            }

            if (startWithoutDebuggingBuild)
            {
                buildFlags |= VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_LAUNCH;
            }

            var solutionBuildManager = ISolutionBuildManagerFactory.ImplementBusy(buildFlags);

            var instance = new ImplicitlyTriggeredDebugBuildManager(
                IProjectThreadingServiceFactory.Create(),
                solutionBuildManager,
                IImplicitlyTriggeredBuildManagerFactory.Create(onImplicitBuildStart, onImplicitBuildEndOrCancel, onImplicitBuildStartWithStartupPaths),
                IStartupProjectHelperFactory.Create(startupProjectFullPaths ?? ImmutableArray <string> .Empty));

            await instance.LoadAsync();

            return(instance);
        }
Beispiel #2
0
        private static async Task <ImplicitlyTriggeredDebugBuildManager> CreateInitializedInstanceAsync(
            Action?onImplicitBuildStart               = null,
            Action?onImplicitBuildEndOrCancel         = null,
            bool startDebuggingBuild                  = false,
            bool startWithoutDebuggingBuild           = false,
            bool skipAnalyzersForImplicitBuildsOption = true)
        {
            var buildFlags = VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_NONE;

            if (startDebuggingBuild)
            {
                buildFlags |= VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_LAUNCHDEBUG;
            }

            if (startWithoutDebuggingBuild)
            {
                buildFlags |= VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_LAUNCH;
            }

            var solutionBuildManager = IVsSolutionBuildManager3Factory.Create(buildFlags: buildFlags);
            var serviceProvider      = IVsServiceFactory.Create <SVsSolutionBuildManager, IVsSolutionBuildManager3>(solutionBuildManager);

            var instance = new ImplicitlyTriggeredDebugBuildManager(
                IProjectThreadingServiceFactory.Create(),
                IProjectSystemOptionsWithChangesFactory.ImplementGetSkipAnalyzersForImplicitlyTriggeredBuildAsync(_ => skipAnalyzersForImplicitBuildsOption),
                serviceProvider,
                IImplicitlyTriggeredBuildManagerFactory.Create(onImplicitBuildStart, onImplicitBuildEndOrCancel));

            await instance.LoadAsync();

            return(instance);
        }