Merge branch 'johluo/fix-deployers' into dev
This commit is contained in:
commit
a04dae1b14
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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}");
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ namespace Microsoft.AspNetCore.Server.Testing
|
|||
// Start timer
|
||||
StartTimer();
|
||||
|
||||
PickRuntime();
|
||||
|
||||
if (DeploymentParameters.PublishApplicationBeforeDeployment)
|
||||
{
|
||||
DotnetPublish();
|
||||
|
|
|
|||
Loading…
Reference in New Issue