diff --git a/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs b/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs index 0e56ed6f14..76ea430a47 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs @@ -74,6 +74,8 @@ namespace Microsoft.AspNetCore.Server.Testing /// public bool PublishApplicationBeforeDeployment { get; set; } + public string PublishTargetFramework { get; set; } + public string PublishedApplicationRootPath { get; set; } /// diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/ApplicationDeployer.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/ApplicationDeployer.cs index e5d63a6caa..67bc196689 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/ApplicationDeployer.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/ApplicationDeployer.cs @@ -37,24 +37,20 @@ namespace Microsoft.AspNetCore.Server.Testing protected ILogger Logger { get; } - protected string TargetFrameworkName { get; private set; } - public abstract DeploymentResult Deploy(); - protected void PickRuntime() - { - TargetFrameworkName = DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? "dnx451" : "netstandardapp1.5"; - - Logger.LogInformation($"Pick target framework {TargetFrameworkName}"); - } - protected void DotnetPublish(string publishRoot = null) { + if (string.IsNullOrEmpty(DeploymentParameters.PublishTargetFramework)) + { + throw new Exception($"A target framework must be specified in the deployment parameters for applications that require publishing before deployment"); + } + DeploymentParameters.PublishedApplicationRootPath = publishRoot ?? Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); var parameters = $"publish {DeploymentParameters.ApplicationPath}" + $" -o {DeploymentParameters.PublishedApplicationRootPath}" - + $" --framework {TargetFrameworkName}"; + + $" --framework {DeploymentParameters.PublishTargetFramework}"; Logger.LogInformation($"Executing command {DotnetCommandName} {parameters}"); diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISDeployer.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISDeployer.cs index 3de8db733c..78132321c8 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISDeployer.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISDeployer.cs @@ -36,8 +36,6 @@ namespace Microsoft.AspNetCore.Server.Testing _application = new IISApplication(DeploymentParameters, Logger); - PickRuntime(); - // Publish to IIS root\application folder. DotnetPublish(publishRoot: _application.WebSiteRootFolder); diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISExpressDeployer.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISExpressDeployer.cs index 62d1d0c5c0..0f491e562f 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISExpressDeployer.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/IISExpressDeployer.cs @@ -27,8 +27,6 @@ namespace Microsoft.AspNetCore.Server.Testing // Start timer StartTimer(); - PickRuntime(); - // For now we always auto-publish. Otherwise we'll have to write our own local web.config for the HttpPlatformHandler DeploymentParameters.PublishApplicationBeforeDeployment = true; if (DeploymentParameters.PublishApplicationBeforeDeployment) diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs index 1bac2ef81b..f28e5dde98 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs @@ -28,8 +28,6 @@ namespace Microsoft.AspNetCore.Server.Testing // Start timer StartTimer(); - PickRuntime(); - if (DeploymentParameters.PublishApplicationBeforeDeployment) { DotnetPublish();