diff --git a/test/E2ETests/Common/Helpers.cs b/test/E2ETests/Common/Helpers.cs index 6b568f2375..8bcabbd3ce 100644 --- a/test/E2ETests/Common/Helpers.cs +++ b/test/E2ETests/Common/Helpers.cs @@ -51,5 +51,23 @@ namespace E2ETests return configuration; } + + public static bool PreservePublishedApplicationForDebugging + { + get + { + var deletePublishedFolder = Environment.GetEnvironmentVariable("ASPNETCORE_DELETEPUBLISHEDFOLDER"); + + if (string.Equals("false", deletePublishedFolder, StringComparison.OrdinalIgnoreCase) + || string.Equals("0", deletePublishedFolder, StringComparison.OrdinalIgnoreCase)) + { + // preserve the published folder and do not delete it + return true; + } + + // do not preserve the published folder and delete it + return false; + } + } } } \ No newline at end of file diff --git a/test/E2ETests/NtlmAuthentationTest.cs b/test/E2ETests/NtlmAuthentationTest.cs index 1c0db6b424..fc50bfdbec 100644 --- a/test/E2ETests/NtlmAuthentationTest.cs +++ b/test/E2ETests/NtlmAuthentationTest.cs @@ -38,6 +38,7 @@ namespace E2ETests var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture) { PublishApplicationBeforeDeployment = true, + PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType, diff --git a/test/E2ETests/OpenIdConnectTests.cs b/test/E2ETests/OpenIdConnectTests.cs index dc7bf573d5..eb4ff17743 100644 --- a/test/E2ETests/OpenIdConnectTests.cs +++ b/test/E2ETests/OpenIdConnectTests.cs @@ -66,6 +66,7 @@ namespace E2ETests var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture) { PublishApplicationBeforeDeployment = true, + PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType, diff --git a/test/E2ETests/PublishAndRunTests.cs b/test/E2ETests/PublishAndRunTests.cs index f25cdd2074..5f49351217 100644 --- a/test/E2ETests/PublishAndRunTests.cs +++ b/test/E2ETests/PublishAndRunTests.cs @@ -148,6 +148,7 @@ namespace E2ETests { ApplicationBaseUriHint = applicationBaseUrl, PublishApplicationBeforeDeployment = true, + PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType, diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index b47d71722c..7fd7596400 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -184,6 +184,7 @@ namespace E2ETests ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null, SiteName = "MusicStoreTestSite", PublishApplicationBeforeDeployment = true, + PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType,