diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs index 4d0279e252..16f310e305 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs @@ -183,18 +183,15 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests await StartAsync(deploymentParameters); } - [ConditionalFact(Skip="https://github.com/aspnet/AspNetCore/issues/3950")] + [ConditionalFact] [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task StartsWithPortableAndBootstraperExe() { var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); // We need the right dotnet on the path in IIS deploymentParameters.EnvironmentVariables["PATH"] = Path.GetDirectoryName(DotNetCommands.GetDotNetExecutable(deploymentParameters.RuntimeArchitecture)); - - // rest publisher as it doesn't support additional parameters - deploymentParameters.ApplicationPublisher = null; // ReferenceTestTasks is workaround for https://github.com/dotnet/sdk/issues/2482 - deploymentParameters.AdditionalPublishParameters = "-p:RuntimeIdentifier=win7-x64 -p:UseAppHost=true -p:SelfContained=false -p:ReferenceTestTasks=false"; + deploymentParameters.AdditionalPublishParameters = "AppHost"; var deploymentResult = await DeployAsync(deploymentParameters); Assert.True(File.Exists(Path.Combine(deploymentResult.ContentRoot, "InProcessWebSite.exe"))); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedApplicationPublisher.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedApplicationPublisher.cs new file mode 100644 index 0000000000..0371d323a2 --- /dev/null +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedApplicationPublisher.cs @@ -0,0 +1,50 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.IO; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.Extensions.Logging; + +namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests +{ + public class PublishedApplicationPublisher: ApplicationPublisher + { + private readonly string _applicationPath; + + public PublishedApplicationPublisher(string applicationPath) : base(applicationPath) + { + _applicationPath = applicationPath; + } + + public override Task Publish(DeploymentParameters deploymentParameters, ILogger logger) + { + // Treat AdditionalPublishParameters as profile name if defined + string profileName; + if (!string.IsNullOrEmpty(deploymentParameters.AdditionalPublishParameters)) + { + profileName = deploymentParameters.AdditionalPublishParameters; + } + else if (deploymentParameters.ApplicationType == ApplicationType.Portable) + { + profileName = "Portable"; + } + else + { + profileName = "Standalone-" + deploymentParameters.RuntimeArchitecture; + } + + var configuration = this.GetType().GetTypeInfo().Assembly.GetCustomAttribute().Configuration; + + var path = Path.Combine(_applicationPath, "bin", configuration, deploymentParameters.TargetFramework, "publish", profileName); + logger.LogInformation("Using prepublished application from {PublishDir}", path); + + var target = CreateTempDirectory(); + + var source = new DirectoryInfo(path); + CachingApplicationPublisher.CopyFiles(source, target, logger); + return Task.FromResult(new PublishedApplication(target.FullName, logger)); + } + } +} diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs index ba11dece7c..7968edc82a 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs @@ -19,13 +19,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public class PublishedSitesFixture : IDisposable { - public CachingApplicationPublisher InProcessTestSite { get; } = new CachingApplicationPublisher(Helpers.GetInProcessTestSitesPath()); - public CachingApplicationPublisher OutOfProcessTestSite { get; } = new CachingApplicationPublisher(Helpers.GetOutOfProcessTestSitesPath()); + public PublishedApplicationPublisher InProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetInProcessTestSitesPath()); + public PublishedApplicationPublisher OutOfProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetOutOfProcessTestSitesPath()); public void Dispose() { - InProcessTestSite.Dispose(); - OutOfProcessTestSite.Dispose(); } public IISDeploymentParameters GetBaseDeploymentParameters(HostingModel hostingModel = HostingModel.InProcess, bool publish = false) diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs index 71bd3eb1d6..253671778e 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs @@ -116,11 +116,13 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests TargetFramework = Tfm.NetCoreApp30, AncmVersion = AncmVersion.AspNetCoreModuleV2, HostingModel = HostingModel.InProcess, - PublishApplicationBeforeDeployment = true, + PublishApplicationBeforeDeployment = true }; _configure(deploymentParameters); + deploymentParameters.ApplicationPublisher = new PublishedApplicationPublisher(deploymentParameters.ApplicationPath); + _deployer = IISApplicationDeployerFactory.Create(deploymentParameters, _loggerFactory); _deploymentResult = (IISDeploymentResult)_deployer.DeployAsync().Result; } diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj index c18df234e8..71bf14e59d 100644 --- a/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj +++ b/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj @@ -6,6 +6,14 @@ netcoreapp3.0 + + + + + + + + diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj index d58bab1d91..9de4366bc1 100644 --- a/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj +++ b/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj @@ -7,6 +7,14 @@ true + + + + + + + + diff --git a/src/Servers/IIS/IIS/test/testassets/OutOfProcessWebSite/OutOfProcessWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/OutOfProcessWebSite/OutOfProcessWebSite.csproj index f3527bf4a4..6a387b9497 100644 --- a/src/Servers/IIS/IIS/test/testassets/OutOfProcessWebSite/OutOfProcessWebSite.csproj +++ b/src/Servers/IIS/IIS/test/testassets/OutOfProcessWebSite/OutOfProcessWebSite.csproj @@ -7,6 +7,12 @@ OutOfProcess + + + + + + diff --git a/src/Servers/IIS/build/testsite.props b/src/Servers/IIS/build/testsite.props index 73ab14f888..8d11b921b0 100644 --- a/src/Servers/IIS/build/testsite.props +++ b/src/Servers/IIS/build/testsite.props @@ -9,6 +9,7 @@ True OutOfProcess + False @@ -78,4 +79,14 @@ + + + + +