internal async Task <ProcessRunner.ProcessResult> BoostrapSvcutilAsync(bool keepBootstrapperDir, ILogger logger, CancellationToken cancellationToken) { ProcessRunner.ProcessResult result = null; using (await SafeLogger.WriteStartOperationAsync(logger, "Bootstrapping svcutil ...").ConfigureAwait(false)) { // guard against bootstrapping recursion. if (this.Options.NoBootstrapping != true) { Debug.Fail($"The NoBootstrapping property is not set, this would cause infinite bootstrapping recursion!"); return(null); } if (this.Options.Project != null && StringComparer.OrdinalIgnoreCase.Compare(this.Options.Project.FileName, SvcutilBootstrapper.ProjectName) == 0) { Debug.Fail("Bootstrapping is enabled for the bootstrapper! This would cause an infinite bootstrapping recursion!"); return(null); } // When in Infrastructure mode (WCF CS) it is assumed the initial progress message is to be presented by the calling tool. ToolConsole.WriteLineIf(ToolConsole.ToolModeLevel != OperationalContext.Infrastructure, Resource.BootstrappingApplicationMsg); await GenerateProjectAsync(keepBootstrapperDir, logger, cancellationToken).ConfigureAwait(false); await GenerateProgramFileAsync(logger, cancellationToken).ConfigureAwait(false); var paramsFilePath = await GenerateParamsFileAsync(logger, cancellationToken).ConfigureAwait(false); await BuildBootstrapProjectAsync(logger, cancellationToken).ConfigureAwait(false); ToolConsole.WriteLineIf(ToolConsole.Verbosity >= Verbosity.Verbose, Resource.InvokingProjectMsg); result = await ProcessRunner.RunAsync("dotnet", $"run \"{paramsFilePath}\"", this.MSBuildProj.DirectoryPath, /*redirectOutput*/ false, logger, cancellationToken).ConfigureAwait(false); MarkupTelemetryHelper.TelemetryPostOperation(result.ExitCode == 0, "Invoke svcutil bootstrapper"); } return(result); }