// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting.Common; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.IntegrationTesting { public class PublishOnlyDeployer : SelfHostDeployer { public PublishOnlyDeployer(DeploymentParameters deploymentParameters, ILoggerFactory loggerFactory) : base(deploymentParameters, loggerFactory) { } public override Task DeployAsync() { using (Logger.BeginScope("SelfHost.Deploy")) { // Start timer StartTimer(); if (DeploymentParameters.PublishApplicationBeforeDeployment) { DotnetPublish(); } var result = new DeploymentResult( LoggerFactory, DeploymentParameters, applicationBaseUri: "http://localhost", contentRoot: DeploymentParameters.PublishApplicationBeforeDeployment ? DeploymentParameters.PublishedApplicationRootPath : DeploymentParameters.ApplicationPath, hostShutdownToken: default(CancellationToken)); return Task.FromResult(result); } } } }