Skip to content

Commit cedf51b

Browse files
committed
Merge branch 'release/2.1' into dev
2 parents c45ea5e + 730a744 commit cedf51b

File tree

7 files changed

+49
-22
lines changed

7 files changed

+49
-22
lines changed

extensions/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<ItemGroup>
1616
<Content Include="applicationHost.xdt" />
17+
<Content Include="scmApplicationHost.xdt" />
1718
<Content Include="bin\$(Configuration)\$(TargetFramework)\Microsoft.Web.Xdt.Extensions.dll" PackagePath="content" />
1819
</ItemGroup>
1920

extensions/Microsoft.AspNetCore.AzureAppServices.SiteExtension/applicationHost.xdt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<system.webServer xdt:Transform="InsertIfMissing">
88
<runtime xdt:Transform="InsertIfMissing" >
99
<environmentVariables xdt:Transform="InsertIfMissing">
10-
<add name="DOTNET_ADDITIONAL_DEPS" value="%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
10+
<add name="DOTNET_ADDITIONAL_DEPS" value="%XDT_EXTENSIONPATH%\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\;%XDT_EXTENSIONPATH%\additionalDeps\Microsoft.AspNetCore.AzureKeyVault.HostingStartup\;%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
11+
<add name="DOTNET_SHARED_STORE" value="%XDT_EXTENSIONPATH%\store" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
1112
<add name="ASPNETCORE_HOSTINGSTARTUPASSEMBLIES" value="Microsoft.AspNetCore.AzureAppServices.HostingStartup" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
1213
</environmentVariables>
1314
</runtime>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
3+
<!-- This file exists to prevent applicationHost.xdt from being applied to scm host that runs
4+
other dotnet processes (dotnet build, csc etc. )-->
5+
</configuration>

test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/TransformTest.cs

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Microsoft.AspNetCore.AzureAppServices.SiteExtension
1111
{
1212
public class TransformTest
1313
{
14+
private static readonly string XdtExtensionPath = AppDomain.CurrentDomain.BaseDirectory;
15+
1416
[Theory]
1517
[InlineData("config_empty.xml")]
1618
[InlineData("config_existingline.xml")]
@@ -24,18 +26,25 @@ public void Transform_EmptyConfig_Added(string configFile)
2426

2527
Assert.NotNull(envNode);
2628

27-
Assert.Equal(2, envNode.ChildNodes.Count);
29+
Assert.Equal(3, envNode.ChildNodes.Count);
30+
31+
var depsElement = envNode.FirstChild;
32+
Assert.Equal("add", depsElement.Name);
33+
Assert.Equal("DOTNET_ADDITIONAL_DEPS", depsElement.Attributes["name"].Value);
34+
Assert.Equal($@"{XdtExtensionPath}\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\;" +
35+
$@"{XdtExtensionPath}\additionalDeps\Microsoft.AspNetCore.AzureKeyVault.HostingStartup\;" +
36+
@"%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\",
37+
depsElement.Attributes["value"].Value);
2838

29-
var firstChild = envNode.FirstChild;
30-
Assert.Equal("add", firstChild.Name);
31-
Assert.Equal("DOTNET_ADDITIONAL_DEPS", firstChild.Attributes["name"].Value);
32-
Assert.Equal(@"%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\",
33-
firstChild.Attributes["value"].Value);
39+
var sharedStoreElement = depsElement.NextSibling;
40+
Assert.Equal("add", sharedStoreElement.Name);
41+
Assert.Equal("DOTNET_SHARED_STORE", sharedStoreElement.Attributes["name"].Value);
42+
Assert.Equal($@"{XdtExtensionPath}\store", sharedStoreElement.Attributes["value"].Value);
3443

35-
var secondChild = firstChild.NextSibling;
36-
Assert.Equal("add", secondChild.Name);
37-
Assert.Equal("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", secondChild.Attributes["name"].Value);
38-
Assert.Equal("Microsoft.AspNetCore.AzureAppServices.HostingStartup", secondChild.Attributes["value"].Value);
44+
var startupAssembliesElement = sharedStoreElement.NextSibling;
45+
Assert.Equal("add", startupAssembliesElement.Name);
46+
Assert.Equal("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", startupAssembliesElement.Attributes["name"].Value);
47+
Assert.Equal("Microsoft.AspNetCore.AzureAppServices.HostingStartup", startupAssembliesElement.Attributes["value"].Value);
3948
}
4049

4150
[Fact]
@@ -48,26 +57,34 @@ public void Transform_ExistingValue_AppendsValue()
4857

4958
Assert.NotNull(envNode);
5059

51-
Assert.Equal(2, envNode.ChildNodes.Count);
60+
Assert.Equal(3, envNode.ChildNodes.Count);
61+
62+
var depsElement = envNode.FirstChild;
63+
Assert.Equal("add", depsElement.Name);
64+
Assert.Equal("DOTNET_ADDITIONAL_DEPS", depsElement.Attributes["name"].Value);
65+
Assert.Equal(@"ExistingValue1;"+
66+
$@"{XdtExtensionPath}\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\;" +
67+
$@"{XdtExtensionPath}\additionalDeps\Microsoft.AspNetCore.AzureKeyVault.HostingStartup\;" +
68+
@"%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\",
69+
depsElement.Attributes["value"].Value);
5270

53-
var firstChild = envNode.FirstChild;
54-
Assert.Equal("add", firstChild.Name);
55-
Assert.Equal("DOTNET_ADDITIONAL_DEPS", firstChild.Attributes["name"].Value);
56-
Assert.Equal(@"ExistingValue1;%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\",
57-
firstChild.Attributes["value"].Value);
71+
var sharedStoreElement = depsElement.NextSibling;
72+
Assert.Equal("add", sharedStoreElement.Name);
73+
Assert.Equal("DOTNET_SHARED_STORE", sharedStoreElement.Attributes["name"].Value);
74+
Assert.Equal($@"ExistingValue3;{XdtExtensionPath}\store", sharedStoreElement.Attributes["value"].Value);
5875

59-
var secondChild = firstChild.NextSibling;
60-
Assert.Equal("add", secondChild.Name);
61-
Assert.Equal("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", secondChild.Attributes["name"].Value);
62-
Assert.Equal("ExistingValue2;Microsoft.AspNetCore.AzureAppServices.HostingStartup", secondChild.Attributes["value"].Value);
76+
var startupAssembliesElement = sharedStoreElement.NextSibling;
77+
Assert.Equal("add", startupAssembliesElement.Name);
78+
Assert.Equal("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", startupAssembliesElement.Attributes["name"].Value);
79+
Assert.Equal("ExistingValue2;Microsoft.AspNetCore.AzureAppServices.HostingStartup", startupAssembliesElement.Attributes["value"].Value);
6380
}
6481

6582
private static XmlDocument LoadDocAndRunTransform(string docName)
6683
{
6784
// Microsoft.Web.Hosting.Transformers.ApplicationHost.SiteExtensionDefinition.Transform
6885
// (See Microsoft.Web.Hosting, Version=7.1.0.0) replaces variables for you in Azure.
6986
var transformFile = File.ReadAllText("applicationHost.xdt");
70-
transformFile = transformFile.Replace("%XDT_EXTENSIONPATH%", AppDomain.CurrentDomain.BaseDirectory);
87+
transformFile = transformFile.Replace("%XDT_EXTENSIONPATH%", XdtExtensionPath);
7188
var transform = new XmlTransformation(transformFile, isTransformAFile: false, logger: null);
7289
var doc = new XmlDocument();
7390
doc.Load(docName);

test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingemptyvalue.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<runtime>
55
<environmentVariables>
66
<add name="DOTNET_ADDITIONAL_DEPS" value="" />
7+
<add name="DOTNET_SHARED_STORE" value="" />
78
<add name="ASPNETCORE_HOSTINGSTARTUPASSEMBLIES" value="" />
89
</environmentVariables>
910
</runtime>

test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingline.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<runtime>
55
<environmentVariables>
66
<add name="DOTNET_ADDITIONAL_DEPS" />
7+
<add name="DOTNET_SHARED_STORE" />
78
<add name="ASPNETCORE_HOSTINGSTARTUPASSEMBLIES" />
89
</environmentVariables>
910
</runtime>

test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingvalue.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<runtime>
55
<environmentVariables>
66
<add name="DOTNET_ADDITIONAL_DEPS" value="ExistingValue1" />
7+
<add name="DOTNET_SHARED_STORE" value="ExistingValue3" />
78
<add name="ASPNETCORE_HOSTINGSTARTUPASSEMBLIES" value="ExistingValue2" />
89
</environmentVariables>
910
</runtime>

0 commit comments

Comments
 (0)