Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 6d04240

Browse files
committed
Fix using too new of C# features in cake
1 parent 2402e9d commit 6d04240

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

build.cake

+8-4
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,14 @@ Task ("nuget-setup").IsDependentOn ("buildtasks").IsDependentOn ("externals")
375375
// Check if we have a proguard.txt file for this artifact and include it in the nuspec if so
376376
if (FileExists (proguardFile)) {
377377
Information ("Adding {0} to {1}", "proguard.txt", nuspecFile);
378-
var filesElem = xNuspec.Root.Descendants (nsNuspec + "files")?.FirstOrDefault();
379-
filesElem.Add (new System.Xml.Linq.XElement (nsNuspec + "file",
380-
new System.Xml.Linq.XAttribute(nsNuspec + "src", proguardFile.ToString()),
381-
new System.Xml.Linq.XAttribute(nsNuspec + "target", "proguard/proguard.txt")));
378+
var filesElems = xNuspec.Root.Descendants (nsNuspec + "files");
379+
380+
if (filesElems != null) {
381+
var filesElem = filesElems.First();
382+
filesElem.Add (new System.Xml.Linq.XElement (nsNuspec + "file",
383+
new System.Xml.Linq.XAttribute(nsNuspec + "src", proguardFile.ToString()),
384+
new System.Xml.Linq.XAttribute(nsNuspec + "target", "proguard/proguard.txt")));
385+
}
382386
}
383387

384388
xNuspec.Save(MakeAbsolute(nuspecFile).FullPath);

0 commit comments

Comments
 (0)