Merge branch 'release' into dev

This commit is contained in:
moozzyk 2016-04-22 11:07:55 -07:00
commit 263241aed6
2 changed files with 35 additions and 0 deletions

View File

@ -65,6 +65,19 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.Tools
if (!isPortable)
{
aspNetCoreElement.SetAttributeValue("processPath", appPath);
var arguments = (string)aspNetCoreElement.Attribute("arguments");
if (arguments != null)
{
const string launcherArgs = "%LAUNCHER_ARGS%";
var position = 0;
while ((position = arguments.IndexOf(launcherArgs, position, StringComparison.OrdinalIgnoreCase)) >= 0)
{
arguments = arguments.Remove(position, launcherArgs.Length);
}
aspNetCoreElement.SetAttributeValue("arguments", arguments.Trim());
}
}
else
{

View File

@ -202,6 +202,28 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.Tools.Tests
aspNetCoreElement));
}
[Theory]
[InlineData("%LAUNCHER_ARGS%", "")]
[InlineData(" %launcher_ARGS%", "")]
[InlineData("%LAUNCHER_args% ", "")]
[InlineData("%LAUNCHER_ARGS% %launcher_args%", "")]
[InlineData(" %LAUNCHER_ARGS% %launcher_args% ", "")]
[InlineData(" %launcher_args% -my-switch", "-my-switch")]
[InlineData("-my-switch %LaUnChEr_ArGs%", "-my-switch")]
[InlineData("-switch-1 %LAUNCHER_ARGS% -switch-2", "-switch-1 -switch-2")]
[InlineData("%LAUNCHER_ARGS% -switch %launcher_args%", "-switch")]
public void WebConfigTransform_removes_LAUNCHER_ARGS_from_arguments_for_standalone_apps(string inputArguments, string outputArguments)
{
var input = WebConfigTemplate;
input.Descendants("aspNetCore").Single().SetAttributeValue("arguments", inputArguments);
var aspNetCoreElement =
WebConfigTransform.Transform(input, "test.exe", configureForAzure: false, isPortable: false)
.Descendants("aspNetCore").Single();
Assert.Equal(outputArguments, (string)aspNetCoreElement.Attribute("arguments"));
}
private bool VerifyMissingElementCreated(params string[] elementNames)
{
var input = WebConfigTemplate;