Updated ApplicationDeployer to conditionally delete published application folder
This commit is contained in:
parent
5968a964c4
commit
cc65ddfa28
|
|
@ -81,6 +81,8 @@ namespace Microsoft.AspNetCore.Server.Testing
|
|||
/// </summary>
|
||||
public bool PublishApplicationBeforeDeployment { get; set; }
|
||||
|
||||
public bool DeletePublishedApplicationOnDispose { get; set; } = true;
|
||||
|
||||
public ApplicationType ApplicationType { get; set; }
|
||||
|
||||
public string PublishedApplicationRootPath { get; set; }
|
||||
|
|
|
|||
|
|
@ -82,14 +82,23 @@ namespace Microsoft.AspNetCore.Server.Testing
|
|||
|
||||
protected void CleanPublishedOutput()
|
||||
{
|
||||
try
|
||||
if (DeploymentParameters.DeletePublishedApplicationOnDispose)
|
||||
{
|
||||
// We've originally published the application in a temp folder. We need to delete it.
|
||||
Directory.Delete(DeploymentParameters.PublishedApplicationRootPath, true);
|
||||
try
|
||||
{
|
||||
// We've originally published the application in a temp folder. We need to delete it.
|
||||
Directory.Delete(DeploymentParameters.PublishedApplicationRootPath, true);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Logger.LogWarning($"Failed to delete directory : {exception.Message}");
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
else
|
||||
{
|
||||
Logger.LogWarning($"Failed to delete directory : {exception.Message}");
|
||||
Logger.LogWarning(
|
||||
"Skipping deleting the locally published folder as property " +
|
||||
$"'{nameof(DeploymentParameters.DeletePublishedApplicationOnDispose)}' is set to 'false'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue