Skip to content

Commit 307e31e

Browse files
committed
Fixed #90 Package installation script fails if there is no xml configuration node.
1 parent fa1568f commit 307e31e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Exceptionless.Signed/NuGet/tools/exceptionless.psm1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ function update_config($configPath, $platform) {
3636
$shouldSave = $false
3737

3838
if ($configXml -ne $null) {
39+
$config = $configXml.SelectSingleNode('configuration')
40+
if ($config -eq $null) {
41+
$configXml.AppendChild($configXml.CreateElement('configuration'))
42+
$shouldSave = $true
43+
}
44+
3945
$configSection = $configXml.SelectSingleNode("configuration/configSections/section[@name='exceptionless']")
4046
if ($configSection -eq $null) {
4147
$parentNode = $configXml.SelectSingleNode("configuration/configSections")
@@ -46,6 +52,7 @@ function update_config($configPath, $platform) {
4652
$parentNode = $configXml.SelectSingleNode("configuration").InsertBefore($configXml.CreateElement('configSections'), $configXml.SelectSingleNode("configuration").ChildNodes[0])
4753
}
4854
}
55+
4956
$configSection = $configXml.CreateElement('section')
5057
$configSection.SetAttribute('name', 'exceptionless')
5158
$configSection.SetAttribute('type', 'Exceptionless.ExceptionlessSection, Exceptionless.Signed')

src/Exceptionless/NuGet/tools/exceptionless.psm1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ function update_config($configPath, $platform) {
3636
$shouldSave = $false
3737

3838
if ($configXml -ne $null) {
39+
$config = $configXml.SelectSingleNode('configuration')
40+
if ($config -eq $null) {
41+
$configXml.AppendChild($configXml.CreateElement('configuration'))
42+
$shouldSave = $true
43+
}
44+
3945
$configSection = $configXml.SelectSingleNode("configuration/configSections/section[@name='exceptionless']")
4046
if ($configSection -eq $null) {
4147
$parentNode = $configXml.SelectSingleNode("configuration/configSections")
@@ -46,6 +52,7 @@ function update_config($configPath, $platform) {
4652
$parentNode = $configXml.SelectSingleNode("configuration").InsertBefore($configXml.CreateElement('configSections'), $configXml.SelectSingleNode("configuration").ChildNodes[0])
4753
}
4854
}
55+
4956
$configSection = $configXml.CreateElement('section')
5057
$configSection.SetAttribute('name', 'exceptionless')
5158
$configSection.SetAttribute('type', 'Exceptionless.ExceptionlessSection, Exceptionless')

0 commit comments

Comments
 (0)