Merge branch 'johluo/fix-deployers' into dev
This commit is contained in:
commit
a04dae1b14
|
|
@ -74,6 +74,8 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool PublishApplicationBeforeDeployment { get; set; }
|
public bool PublishApplicationBeforeDeployment { get; set; }
|
||||||
|
|
||||||
|
public string PublishTargetFramework { get; set; }
|
||||||
|
|
||||||
public string PublishedApplicationRootPath { get; set; }
|
public string PublishedApplicationRootPath { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -37,24 +37,20 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
|
|
||||||
protected ILogger Logger { get; }
|
protected ILogger Logger { get; }
|
||||||
|
|
||||||
protected string TargetFrameworkName { get; private set; }
|
|
||||||
|
|
||||||
public abstract DeploymentResult Deploy();
|
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)
|
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());
|
DeploymentParameters.PublishedApplicationRootPath = publishRoot ?? Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||||
|
|
||||||
var parameters = $"publish {DeploymentParameters.ApplicationPath}"
|
var parameters = $"publish {DeploymentParameters.ApplicationPath}"
|
||||||
+ $" -o {DeploymentParameters.PublishedApplicationRootPath}"
|
+ $" -o {DeploymentParameters.PublishedApplicationRootPath}"
|
||||||
+ $" --framework {TargetFrameworkName}";
|
+ $" --framework {DeploymentParameters.PublishTargetFramework}";
|
||||||
|
|
||||||
Logger.LogInformation($"Executing command {DotnetCommandName} {parameters}");
|
Logger.LogInformation($"Executing command {DotnetCommandName} {parameters}");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
|
|
||||||
_application = new IISApplication(DeploymentParameters, Logger);
|
_application = new IISApplication(DeploymentParameters, Logger);
|
||||||
|
|
||||||
PickRuntime();
|
|
||||||
|
|
||||||
// Publish to IIS root\application folder.
|
// Publish to IIS root\application folder.
|
||||||
DotnetPublish(publishRoot: _application.WebSiteRootFolder);
|
DotnetPublish(publishRoot: _application.WebSiteRootFolder);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
// Start timer
|
// Start timer
|
||||||
StartTimer();
|
StartTimer();
|
||||||
|
|
||||||
PickRuntime();
|
|
||||||
|
|
||||||
// For now we always auto-publish. Otherwise we'll have to write our own local web.config for the HttpPlatformHandler
|
// For now we always auto-publish. Otherwise we'll have to write our own local web.config for the HttpPlatformHandler
|
||||||
DeploymentParameters.PublishApplicationBeforeDeployment = true;
|
DeploymentParameters.PublishApplicationBeforeDeployment = true;
|
||||||
if (DeploymentParameters.PublishApplicationBeforeDeployment)
|
if (DeploymentParameters.PublishApplicationBeforeDeployment)
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
// Start timer
|
// Start timer
|
||||||
StartTimer();
|
StartTimer();
|
||||||
|
|
||||||
PickRuntime();
|
|
||||||
|
|
||||||
if (DeploymentParameters.PublishApplicationBeforeDeployment)
|
if (DeploymentParameters.PublishApplicationBeforeDeployment)
|
||||||
{
|
{
|
||||||
DotnetPublish();
|
DotnetPublish();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue