diff --git a/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs b/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs
index cd17ba1d35..b0b77079bb 100644
--- a/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs
+++ b/src/Microsoft.AspNetCore.Server.Testing/Common/DeploymentParameters.cs
@@ -69,6 +69,8 @@ namespace Microsoft.AspNetCore.Server.Testing
public string ApplicationPath { get; set; }
+ public string TargetFramework { get; set; }
+
///
/// To publish the application before deployment.
///
@@ -76,8 +78,6 @@ namespace Microsoft.AspNetCore.Server.Testing
public ApplicationType ApplicationType { 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 5c3c710c03..4b49e7772f 100644
--- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/ApplicationDeployer.cs
+++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/ApplicationDeployer.cs
@@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.Testing
protected void DotnetPublish(string publishRoot = null)
{
- if (string.IsNullOrEmpty(DeploymentParameters.PublishTargetFramework))
+ if (string.IsNullOrEmpty(DeploymentParameters.TargetFramework))
{
throw new Exception($"A target framework must be specified in the deployment parameters for applications that require publishing before deployment");
}
@@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Server.Testing
var parameters = $"publish \"{DeploymentParameters.ApplicationPath}\""
+ $" -o \"{DeploymentParameters.PublishedApplicationRootPath}\""
- + $" --framework {DeploymentParameters.PublishTargetFramework}";
+ + $" --framework {DeploymentParameters.TargetFramework}";
Logger.LogInformation($"Executing command {DotnetCommandName} {parameters}");
diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs
index 210a61cf83..976a06892d 100644
--- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs
+++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs
@@ -74,8 +74,10 @@ namespace Microsoft.AspNetCore.Server.Testing
}
else
{
+ var targetFramework = DeploymentParameters.TargetFramework ?? (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0");
+
executableName = DotnetCommandName;
- executableArgs = $"run -p \"{DeploymentParameters.ApplicationPath}\" {DotnetArgumentSeparator}";
+ executableArgs = $"run -p \"{DeploymentParameters.ApplicationPath}\" --framework {targetFramework} {DotnetArgumentSeparator}";
}
executableArgs += $" --server.urls {uri} "