Skip to content

Commit 7726bb2

Browse files
committed
make sure we patch all elements in nuspec not just the first match
1 parent 87380ff commit 7726bb2

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

build/scripts/Releasing.fsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,30 +99,36 @@ module Release =
9999
let iconNode = doc.XPathSelectElement("/x:package/x:metadata/x:iconUrl", nsManager)
100100
iconNode.Value <- replace "icon" "icon-aux" iconNode.Value
101101
let xmlConfig = sprintf "/x:package//x:file[contains(@src, '%s.xml')]" p.Name
102-
doc.XPathSelectElement(xmlConfig, nsManager).Remove();
102+
doc.XPathSelectElements(xmlConfig, nsManager).Remove();
103103

104104
let dll n = sprintf "%s.dll" n
105105
let rewriteDllFile name =
106106
let d = dll name
107107
let r = (dll (p.Versioned name (Some currentMajorVersion)))
108108
let x = sprintf "/x:package//x:file[contains(@src, '%s')]" d
109-
let dllNode = doc.XPathSelectElement(x, nsManager)
110-
let src = dllNode.Attribute(xName "src");
111-
src.Value <- replace d r src.Value
109+
let dllNodes = doc.XPathSelectElements(x, nsManager)
110+
dllNodes |> Seq.iter (fun e ->
111+
let src = e.Attribute(xName "src");
112+
src.Value <- replace d r src.Value
113+
)
112114

113115
match p with
114116
| Project Nest ->
115-
let esDep = doc.XPathSelectElement("/x:package/x:metadata//x:dependency[@id='Elasticsearch.Net']", nsManager);
116-
let esDep = esDep.Attribute(xName "id");
117-
esDep.Value <- sprintf "Elasticsearch.Net.v%s" currentMajorVersion
117+
let esDeps = doc.XPathSelectElements("/x:package/x:metadata//x:dependency[@id='Elasticsearch.Net']", nsManager);
118+
esDeps |> Seq.iter(fun e ->
119+
let esDep = e.Attribute(xName "id");
120+
esDep.Value <- sprintf "Elasticsearch.Net.v%s" currentMajorVersion
121+
)
118122
rewriteDllFile p.Name
119123
| Project ElasticsearchNet ->
120124
rewriteDllFile p.Name
121125
ignore()
122126
| Project NestJsonNetSerializer ->
123-
let nestDep = doc.XPathSelectElement("/x:package/x:metadata//x:dependency[@id='NEST']", nsManager);
124-
let idAtt = nestDep.Attribute(xName "id");
125-
idAtt.Value <- sprintf "NEST.v%s" currentMajorVersion
127+
let nestDeps = doc.XPathSelectElements("/x:package/x:metadata//x:dependency[@id='NEST']", nsManager);
128+
nestDeps |> Seq.iter (fun e ->
129+
let idAtt = e.Attribute(xName "id");
130+
idAtt.Value <- sprintf "NEST.v%s" currentMajorVersion
131+
)
126132
rewriteDllFile p.Name
127133
| _ -> traceError (sprintf "%s still needs special canary handling" p.Name)
128134
doc.Save(nuspecVersioned)

0 commit comments

Comments
 (0)