Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tippmar-nr committed Jan 31, 2025
1 parent 11e9504 commit 0f5369b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions build/Packaging/AzureSiteExtension/Content/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,20 @@ function InstallNewAgent($newRelicNugetContentPath, $newRelicInstallPath, $newRe
}
}

function RemoveXmlElement($file, $xPath)
function RemoveXmlElements($file, $xPaths)
{
$xdoc = new-object System.Xml.XmlDocument
$xdoc.load($file)
$namespaceManager = new-object System.Xml.XmlNamespaceManager($xdoc.NameTable)
$namespaceManager.AddNamespace("xdt", "http://schemas.microsoft.com/XML-Document-Transform")

$node = $xdoc.SelectSingleNode($xPath, $namespaceManager)
if ($node -ne $null)
foreach ($xPath in $xPaths)
{
$node.ParentNode.RemoveChild($node)
$node = $xdoc.SelectSingleNode($xPath, $namespaceManager)
if ($node -ne $null)
{
$node.ParentNode.RemoveChild($node)
}
}
$xdoc.Save($file)
}
Expand Down Expand Up @@ -385,7 +388,7 @@ try
AddXmlElements $file $xPaths

WriteToInstallLog "Removing <system.applicationHost> element from applicationHost.xdt"
RemoveXmlElement $file "/configuration/system.applicationHost"
RemoveXmlElements $file @("/configuration/system.applicationHost")
}


Expand Down

0 comments on commit 0f5369b

Please sign in to comment.