File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
src/PostSharp.Engineering.BuildTools/Build/Files Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,24 @@ public static bool TryWrite(
9090
9191 // Load XML.
9292 var thisAutoUpdatedVersionsFilePath = Path . Combine ( context . RepoDirectory , context . Product . AutoUpdatedVersionsFilePath ) ;
93- var thisAutoUpdatedVersionsDocument = XDocument . Load ( thisAutoUpdatedVersionsFilePath , LoadOptions . PreserveWhitespace ) ;
94- var thisAutoUpdatedVersionsPropertyGroupElement = thisAutoUpdatedVersionsDocument . Root ! . Element ( "PropertyGroup" ) ! ;
9593
94+ XDocument thisAutoUpdatedVersionsDocument ;
95+
96+ XElement thisAutoUpdatedVersionsPropertyGroupElement ;
97+
98+ if ( File . Exists ( thisAutoUpdatedVersionsFilePath ) )
99+ {
100+ thisAutoUpdatedVersionsDocument = XDocument . Load ( thisAutoUpdatedVersionsFilePath , LoadOptions . PreserveWhitespace ) ;
101+ thisAutoUpdatedVersionsPropertyGroupElement = thisAutoUpdatedVersionsDocument . Root ! . Element ( "PropertyGroup" ) ! ;
102+ }
103+ else
104+ {
105+ thisAutoUpdatedVersionsDocument = new XDocument ( ) ;
106+ thisAutoUpdatedVersionsDocument . Add ( new XElement ( "Project" ) ) ;
107+ thisAutoUpdatedVersionsPropertyGroupElement = new XElement ( "PropertyGroup" ) ;
108+ thisAutoUpdatedVersionsDocument . Root ! . Add ( thisAutoUpdatedVersionsPropertyGroupElement ) ;
109+ }
110+
96111 // Update dependency versions.
97112 var errors = 0 ;
98113 string ? inheritedMainVersion = null ;
You can’t perform that action at this time.
0 commit comments