Merge branch 'johluo/fix-deployers' into dev

This commit is contained in:
John Luo 2016-03-04 12:11:20 -08:00
commit a04dae1b14
5 changed files with 8 additions and 16 deletions

View File

@ -74,6 +74,8 @@ namespace Microsoft.AspNetCore.Server.Testing
/// </summary>
public bool PublishApplicationBeforeDeployment { get; set; }
public string PublishTargetFramework { get; set; }
public string PublishedApplicationRootPath { get; set; }
/// <summary>

View File

@ -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}");

View File

@ -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);

View File

@ -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)

View File

@ -28,8 +28,6 @@ namespace Microsoft.AspNetCore.Server.Testing
// Start timer
StartTimer();
PickRuntime();
if (DeploymentParameters.PublishApplicationBeforeDeployment)
{
DotnetPublish();