diff --git a/src/Publish/Microsoft.NET.Sdk.Publish.Targets/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets b/src/Publish/Microsoft.NET.Sdk.Publish.Targets/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets index 8970d68c..d0d5c401 100644 --- a/src/Publish/Microsoft.NET.Sdk.Publish.Targets/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets +++ b/src/Publish/Microsoft.NET.Sdk.Publish.Targets/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets @@ -36,10 +36,11 @@ Copyright (C) Microsoft Corporation. All rights reserved. <_IsAspNetCoreProject Condition="%(ProjectCapability.Identity) == 'AspNetCore'">true - <_IsPortable Condition=" '$(_IsPortable)' == '' And '$(SelfContained)' == 'true' ">false - <_IsPortable Condition=" '$(_IsPortable)' == ''">true + <_UseAppHost Condition=" '$(_UseAppHost)' == '' ">$(UseAppHost) + <_UseAppHost Condition=" '$(_UseAppHost)' == ''">$(SelfContained) + <_UseAppHost Condition=" '$(_UseAppHost)' == ''">false <_ExecutableExtension Condition="'$(_ExecutableExtension)' == '' and $(RuntimeIdentifier.StartsWith('win'))">.exe - <_TransformWebConfigForAzure Condition=" '$(WEBSITE_SITE_NAME)' != '' Or '$(DOTNET_CONFIGURE_AZURE)' == 'true' Or '$(DOTNET_CONFIGURE_AZURE)' == '1'">true + <_TransformWebConfigForAzure Condition=" '$(PublishProvider)' == 'AzureWebSite' Or '$(WEBSITE_SITE_NAME)' != '' Or '$(DOTNET_CONFIGURE_AZURE)' == 'true' Or '$(DOTNET_CONFIGURE_AZURE)' == '1'">true @@ -47,7 +48,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Condition="'$(_IsAspNetCoreProject)' == 'true' And '$(IsTransformWebConfigDisabled)' != 'true' And '$(IsWebConfigTransformDisabled)' != 'true'" TargetPath="$(TargetPath)" PublishDir="$(PublishIntermediateOutputPath)" - IsPortable="$(_IsPortable)" + UseAppHost="$(UseAppHost)" ExecutableExtension="$(_ExecutableExtension)" IsAzure="$(_TransformWebConfigForAzure)" ProjectGuid="$(ProjectGuid)" @@ -112,8 +113,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. <_IsWebJobProject Condition="'$(_IsWebJobProject)' == '' and '$(WebJobName)' != '' and '$(WebJobType)' != ''">true - <_IsPortable Condition=" '$(_IsPortable)' == '' And '$(RuntimeIdentifier)' != '' ">false - <_IsPortable Condition=" '$(_IsPortable)' == ''">true + <_UseAppHost Condition=" '$(_UseAppHost)' == '' ">$(UseAppHost) + <_UseAppHost Condition=" '$(_UseAppHost)' == '' ">$(SelfContained) + <_UseAppHost Condition=" '$(_UseAppHost)' == '' ">false <_ExecutableExtension Condition="'$(_ExecutableExtension)' == '' and $(RuntimeIdentifier.StartsWith('win'))">.exe @@ -122,7 +124,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. ProjectDirectory="$(MSBuildProjectDirectory)" TargetPath="$(TargetPath)" WebJobsDirectory="$(PublishIntermediateOutputPath)\app_data\Jobs\$(WebJobType)\$(WebJobName)\" - IsPortable="$(_IsPortable)" + UseAppHost="$(_UseAppHost)" ExecutableExtension="$(_ExecutableExtension)" /> \ No newline at end of file diff --git a/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/TransformWebConfig.cs b/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/TransformWebConfig.cs index fc6d3af3..b725d13e 100644 --- a/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/TransformWebConfig.cs +++ b/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/TransformWebConfig.cs @@ -22,12 +22,8 @@ public class TransformWebConfig : Task [Required] public string PublishDir { get; set; } - /// - /// The application being published is a portable .NET Core application - /// - /// [Required] - public bool IsPortable { get; set; } + public bool UseAppHost { get; set; } /// /// [optional] Transform is targeted for Azure @@ -89,7 +85,7 @@ public override bool Execute() } string outputFile = Path.GetFileName(TargetPath); - XDocument transformedConfig = WebConfigTransform.Transform(webConfigXml, outputFile, IsAzure, IsPortable, ExecutableExtension, AspNetCoreModuleHostingModel); + XDocument transformedConfig = WebConfigTransform.Transform(webConfigXml, outputFile, IsAzure, UseAppHost, ExecutableExtension, AspNetCoreModuleHostingModel); // Telemetry transformedConfig = WebConfigTelemetry.AddTelemetry(transformedConfig, ProjectGuid, IgnoreProjectGuid, SolutionPath, ProjectFullPath); diff --git a/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/WebJobs/GenerateRunCommandFile.cs b/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/WebJobs/GenerateRunCommandFile.cs index 70fe1486..371b70db 100644 --- a/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/WebJobs/GenerateRunCommandFile.cs +++ b/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/Tasks/WebJobs/GenerateRunCommandFile.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -14,7 +15,7 @@ public class GenerateRunCommandFile : Task [Required] public string TargetPath { get; set; } [Required] - public bool IsPortable { get; set; } + public bool UseAppHost { get; set; } public string ExecutableExtension { get; set; } public override bool Execute() @@ -23,8 +24,9 @@ public override bool Execute() if (!isRunCommandFilePresent) { string appName = Path.GetFileName(TargetPath); + string command = $"dotnet {appName}"; - if (!IsPortable) + if (UseAppHost || string.Equals(Path.GetExtension(TargetPath), ".exe", StringComparison.OrdinalIgnoreCase)) { command = Path.ChangeExtension(appName, !string.IsNullOrWhiteSpace(ExecutableExtension) ? ExecutableExtension : null); } diff --git a/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/WebConfigTransform.cs b/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/WebConfigTransform.cs index c00120be..26e6731d 100644 --- a/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/WebConfigTransform.cs +++ b/src/Publish/Microsoft.NET.Sdk.Publish.Tasks/WebConfigTransform.cs @@ -10,7 +10,7 @@ namespace Microsoft.NET.Sdk.Publish.Tasks { public static class WebConfigTransform { - public static XDocument Transform(XDocument webConfig, string appName, bool configureForAzure, bool isPortable, string extension, string aspNetCoreHostingModel) + public static XDocument Transform(XDocument webConfig, string appName, bool configureForAzure, bool useAppHost, string extension, string aspNetCoreHostingModel) { const string HandlersElementName = "handlers"; const string aspNetCoreElementName = "aspNetCore"; @@ -22,7 +22,7 @@ public static XDocument Transform(XDocument webConfig, string appName, bool conf var webServerSection = GetOrCreateChild(webConfig.Root, "system.webServer"); TransformHandlers(GetOrCreateChild(webServerSection, HandlersElementName)); - TransformAspNetCore(GetOrCreateChild(webServerSection, aspNetCoreElementName), appName, configureForAzure, isPortable, extension, aspNetCoreHostingModel); + TransformAspNetCore(GetOrCreateChild(webServerSection, aspNetCoreElementName), appName, configureForAzure, useAppHost, extension, aspNetCoreHostingModel); // make sure that the aspNetCore element is after handlers element var aspNetCoreElement = webServerSection.Element(HandlersElementName) @@ -55,21 +55,16 @@ private static void TransformHandlers(XElement handlersElement) SetAttributeValueIfEmpty(aspNetCoreElement, "resourceType", "Unspecified"); } - private static void TransformAspNetCore(XElement aspNetCoreElement, string appName, bool configureForAzure, bool isPortable, string extension, string aspNetCoreHostingModel) + private static void TransformAspNetCore(XElement aspNetCoreElement, string appName, bool configureForAzure, bool useAppHost, string extension, string aspNetCoreHostingModel) { // Forward slashes currently work neither in AspNetCoreModule nor in dotnet so they need to be // replaced with backwards slashes when the application is published on a non-Windows machine var appPath = Path.Combine(".", appName).Replace("/", "\\"); - var originalExtension = Path.GetExtension(appPath); RemoveLauncherArgs(aspNetCoreElement); - if (!isPortable) + if (useAppHost || string.Equals(Path.GetExtension(appPath), ".exe", StringComparison.OrdinalIgnoreCase)) { appPath = Path.ChangeExtension(appPath, !string.IsNullOrWhiteSpace(extension) ? extension : null); - } - - if (!isPortable || string.Equals(originalExtension, ".exe", StringComparison.OrdinalIgnoreCase)) - { aspNetCoreElement.SetAttributeValue("processPath", appPath); } else diff --git a/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTelemetryTests.cs b/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTelemetryTests.cs index 6d504ec3..0234ab46 100644 --- a/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTelemetryTests.cs +++ b/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTelemetryTests.cs @@ -66,7 +66,7 @@ public void WebConfigTransform_Finds_ProjectGuid_IfProjectPathIsPassed(string so public void WebConfigTelemetry_SetsProjectGuidIfNotOptedOut(string projectGuid) { // Arrange - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, isPortable: false, extension:".exe", aspNetCoreHostingModel:null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, useAppHost: true, extension:".exe", aspNetCoreHostingModel:null); Assert.True(XNode.DeepEquals(WebConfigTemplate, transformedWebConfig)); //Act @@ -81,7 +81,7 @@ public void WebConfigTelemetry_SetsProjectGuidIfNotOptedOut(string projectGuid) public void WebConfigTelemetry_DoesNotSetProjectGuidIfOptedOut_ThroughIgnoreProjectGuid(string projectGuid) { // Arrange - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel:null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel:null); Assert.True(XNode.DeepEquals(WebConfigTemplate, transformedWebConfig)); //Act @@ -96,7 +96,7 @@ public void WebConfigTelemetry_DoesNotSetProjectGuidIfOptedOut_ThroughIgnoreProj public void WebConfigTelemetry_RemovesProjectGuidIfOptedOut_ThroughIgnoreProjectGuid(string projectGuid) { // Arrange - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel:null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel:null); Assert.True(XNode.DeepEquals(WebConfigTemplate, transformedWebConfig)); // Adds Guid to the config XDocument transformedWebConfigWithGuid = WebConfigTelemetry.AddTelemetry(transformedWebConfig, projectGuid, false, null, null); @@ -116,7 +116,7 @@ public void WebConfigTelemetry_FindsProjectGuid_IfCLIOptedOutEnvVariableIsNotSet { // Arrange string projectFullPath = GetTestProjectsFullPath(); - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null); string previousValue = Environment.GetEnvironmentVariable(TelemetryOptout); //Act @@ -135,7 +135,7 @@ public void WebConfigTelemetry_DoesNotSearchForProjectGuid_IfCLIOptedOutEnvVaria { // Arrange string projectFullPath = GetTestProjectsFullPath(); - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.exe", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null); string previousValue = Environment.GetEnvironmentVariable(TelemetryOptout); //Act diff --git a/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTransformTests.cs b/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTransformTests.cs index 873b5cf5..de0fa191 100644 --- a/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTransformTests.cs +++ b/test/Publish/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTransformTests.cs @@ -56,27 +56,27 @@ public class WebConfigTransformTests public void WebConfigTransform_creates_new_config_if_one_does_not_exist() { Assert.True(XNode.DeepEquals(WebConfigTemplate, - WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel:null))); + WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel:null))); Assert.True(XNode.DeepEquals(WebConfigTemplatePortable, - WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, isPortable: true, extension: null, aspNetCoreHostingModel: null))); + WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, useAppHost: false, extension: null, aspNetCoreHostingModel: null))); } [Fact] public void WebConfigTransform_creates_ProcessPath_WithCorrectExtension() { Assert.True(XNode.DeepEquals(WebConfigTemplate, - WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null))); + WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null))); Assert.True(XNode.DeepEquals(WebConfigTemplateWithOutExe, - WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, isPortable: false, extension: null, aspNetCoreHostingModel: null))); + WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, useAppHost: true, extension: null, aspNetCoreHostingModel: null))); } [Fact] public void WebConfigTransform_creates_new_config_if_one_has_unexpected_format() { Assert.True(XNode.DeepEquals(WebConfigTemplate, - WebConfigTransform.Transform(XDocument.Parse(""), "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null))); + WebConfigTransform.Transform(XDocument.Parse(""), "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null))); } [Theory] @@ -96,7 +96,7 @@ public void WebConfigTransform_adds_missing_elements(string[] elementNames) } Assert.True(XNode.DeepEquals(WebConfigTemplate, - WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null))); + WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null))); } [Theory] @@ -113,7 +113,7 @@ public void WebConfigTransform_wont_override_custom_values(string elementName, s var input = WebConfigTemplate; input.Descendants(elementName).Single().SetAttributeValue(attributeName, attributeValue); - var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null); + var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null); Assert.Equal(attributeValue, (string)output.Descendants(elementName).Single().Attribute(attributeName)); } @@ -128,7 +128,7 @@ public void WebConfigTransform_will_UseHostingModel_FromWebConfigIfPresent(strin var input = WebConfigTemplate; input.Descendants(elementName).Single().SetAttributeValue(attributeName, attributeValue); - var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: "foo"); + var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: "foo"); Assert.Equal(attributeValue, (string)output.Descendants(elementName).Single().Attribute(attributeName)); } @@ -141,7 +141,7 @@ public void WebConfigTransform_UsesAspNetCoreHostingModelValue_ForHostingModel(s { var input = WebConfigTemplate; - var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: attributeValue); + var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: attributeValue); Assert.Equal(attributeValue, (string)output.Descendants(elementName).Single().Attribute(attributeName)); } @@ -151,7 +151,7 @@ public void WebConfigTransform_Throws_IfHostingModelValueIsUndefined(string attr { var input = WebConfigTemplate; - Assert.Throws(() => WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: attributeValue)); + Assert.Throws(() => WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: attributeValue)); } [Theory] @@ -160,7 +160,7 @@ public void WebConfigTransform_DoesNotSet_HostingModelIfEmpty(string elementName { var input = WebConfigTemplate; - var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: attributeValue); + var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: attributeValue); Assert.Null((string)output.Descendants(elementName).Single().Attribute(attributeName)); } @@ -168,7 +168,7 @@ public void WebConfigTransform_DoesNotSet_HostingModelIfEmpty(string elementName public void WebConfigTransform_overwrites_processPath() { var newProcessPath = - (string)WebConfigTransform.Transform(WebConfigTemplate, "app.exe", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null) + (string)WebConfigTransform.Transform(WebConfigTemplate, "app.exe", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null) .Descendants("aspNetCore").Single().Attribute("processPath"); Assert.Equal(@".\app.exe", newProcessPath); @@ -181,7 +181,7 @@ public void WebConfigTransform_fixes_aspnetcore_casing() input.Descendants("add").Single().SetAttributeValue("name", "aspnetcore"); Assert.True(XNode.DeepEquals(WebConfigTemplate, - WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null))); + WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null))); } [Fact] @@ -194,7 +194,7 @@ public void WebConfigTransform_does_not_remove_children_of_aspNetCore_element() input.Descendants("aspNetCore").Single().Add(envVarElement); Assert.True(XNode.DeepEquals(envVarElement, - WebConfigTransform.Transform(input, "app.exe", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null) + WebConfigTransform.Transform(input, "app.exe", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null) .Descendants("environmentVariable").SingleOrDefault(e => (string)e.Attribute("name") == "ENVVAR"))); } @@ -206,7 +206,7 @@ public void WebConfigTransform_adds_stdoutLogEnabled_if_attribute_is_missing() Assert.Equal( "false", - (string)WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null) + (string)WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null) .Descendants().Attributes("stdoutLogEnabled").Single()); } @@ -227,7 +227,7 @@ public void WebConfigTransform_adds_stdoutLogFile_if_attribute_is_missing(string Assert.Equal( @".\logs\stdout", - (string)WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null) + (string)WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null) .Descendants().Attributes("stdoutLogFile").Single()); } @@ -249,7 +249,7 @@ public void WebConfigTransform_does_not_change_existing_stdoutLogEnabled(string Assert.Equal( "mylog.txt", - (string)WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null) + (string)WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null) .Descendants().Attributes("stdoutLogFile").Single()); } @@ -259,7 +259,7 @@ public void WebConfigTransform_correctly_configures_for_Azure() var input = WebConfigTemplate; input.Descendants("aspNetCore").Attributes().Remove(); - var aspNetCoreElement = WebConfigTransform.Transform(input, "test.dll", configureForAzure: true, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null) + var aspNetCoreElement = WebConfigTransform.Transform(input, "test.dll", configureForAzure: true, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null) .Descendants("aspNetCore").Single(); aspNetCoreElement.Elements().Remove(); @@ -273,7 +273,7 @@ public void WebConfigTransform_correctly_configures_for_Azure() public void WebConfigTransform_overwrites_stdoutLogPath_for_Azure() { var input = WebConfigTemplate; - var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: true, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null); + var output = WebConfigTransform.Transform(input, "test.dll", configureForAzure: true, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null); Assert.Equal( @"\\?\%home%\LogFiles\stdout", @@ -284,7 +284,7 @@ public void WebConfigTransform_overwrites_stdoutLogPath_for_Azure() public void WebConfigTransform_configures_portable_apps_correctly() { var aspNetCoreElement = - WebConfigTransform.Transform(WebConfigTemplate, "test.dll", configureForAzure: false, isPortable: true, extension: ".exe", aspNetCoreHostingModel: null) + WebConfigTransform.Transform(WebConfigTemplate, "test.dll", configureForAzure: false, useAppHost: false, extension: ".exe", aspNetCoreHostingModel: null) .Descendants("aspNetCore").Single(); Assert.True(XNode.DeepEquals( @@ -297,7 +297,7 @@ public void WebConfigTransform_configures_portable_apps_correctly() public void WebConfigTransform_configures_full_framework_apps_correctly() { var aspNetCoreElement = - WebConfigTransform.Transform(WebConfigTemplate, "test.exe", configureForAzure: false, isPortable: true, extension: ".exe", aspNetCoreHostingModel: null) + WebConfigTransform.Transform(WebConfigTemplate, "test.exe", configureForAzure: false, useAppHost: false, extension: ".exe", aspNetCoreHostingModel: null) .Descendants("aspNetCore").Single(); Assert.True(XNode.DeepEquals( @@ -331,7 +331,7 @@ public void WebConfigTransform_removes_LAUNCHER_ARGS_from_arguments_for_standalo input.Descendants("aspNetCore").Single().SetAttributeValue("arguments", inputArguments); var aspNetCoreElement = - WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null) + WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null) .Descendants("aspNetCore").Single(); Assert.Equal(outputArguments, (string)aspNetCoreElement.Attribute("arguments")); @@ -357,7 +357,7 @@ public void WebConfigTransform_wont_override_existing_args_for_portable_apps(str input.Descendants("aspNetCore").Single().SetAttributeValue("arguments", inputArguments); var aspNetCoreElement = - WebConfigTransform.Transform(input, "myapp.dll", configureForAzure: false, isPortable: true, extension: ".exe", aspNetCoreHostingModel: null) + WebConfigTransform.Transform(input, "myapp.dll", configureForAzure: false, useAppHost: false, extension: ".exe", aspNetCoreHostingModel: null) .Descendants("aspNetCore").Single(); Assert.Equal(outputArguments, (string)aspNetCoreElement.Attribute("arguments")); @@ -373,7 +373,7 @@ private bool VerifyMissingElementCreated(params string[] elementNames) } return XNode.DeepEquals(WebConfigTemplate, - WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null)); + WebConfigTransform.Transform(input, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null)); } [Theory] @@ -387,7 +387,7 @@ private bool VerifyMissingElementCreated(params string[] elementNames) public void WebConfigTransform_Adds_ProjectGuid_IfNotPresent(string projectGuid) { // Arrange - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null); Assert.True(XNode.DeepEquals(WebConfigTemplate, transformedWebConfig)); // Act @@ -408,7 +408,7 @@ public void WebConfigTransform_Adds_ProjectGuid_IfNotPresent(string projectGuid) public void WebConfigTransform_Removes_ProjectGuid_IfIgnorePropertyIsSet(string projectGuid) { // Arrange - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null); Assert.True(XNode.DeepEquals(WebConfigTemplate, transformedWebConfig)); XDocument transformedWebConfigWithGuid = WebConfigTransform.AddProjectGuidToWebConfig(transformedWebConfig, projectGuid, false); Assert.True(XNode.DeepEquals(WebConfigTemplateWithProjectGuid, transformedWebConfigWithGuid)); @@ -425,7 +425,7 @@ public void WebConfigTransform_Removes_ProjectGuid_IfIgnorePropertyIsSet(string public void WebConfigTransform_DoesNothingWithProjectGuid_IfAbsent() { // Arrange - XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, isPortable: false, extension: ".exe", aspNetCoreHostingModel: null); + XDocument transformedWebConfig = WebConfigTransform.Transform(null, "test.dll", configureForAzure: false, useAppHost: true, extension: ".exe", aspNetCoreHostingModel: null); Assert.True(XNode.DeepEquals(WebConfigTemplate, transformedWebConfig)); // Act