title: Why do I keep getting a list of properties when adding a node in powershell?
body: <p>I'm using powershell to update the Version node in a wpf csproj file. Everytime I add the version node (never understood I have to when it's already there), suddenly a list of properties appear.</p>
  <pre><code># My Wpf App
  Write-Host &quot;WpfApp Versioning started&quot;
  
  $sourceDir = &quot;C:\Users\me\source\repos\mysolution&quot;
  
  $csprojfilename = $sourceDir +&quot;\myapp\myapp.csproj&quot;
  &quot;Project file to update &quot; + $csprojfilename
  
  [xml]$csprojcontents = Get-Content -Path $csprojfilename;
  
  &quot;Current version number is &quot; + $csprojcontents.Project.PropertyGroup.Version + &quot;.&quot;
  $oldversionNumber = $csprojcontents.Project.PropertyGroup.Version
  
  # https://gist.github.com/bcnzer/f8d50699c5bf7614923bff733662cb1a
  if ($csprojcontents.Project.PropertyGroup.name -notmatch &quot;Version&quot;) 
  { 
      Write-Host &quot;Version is null.&quot;
      $csprojcontents.Project.PropertyGroup.AppendChild($csprojcontents.ImportNode(([xml]&quot;&lt;Version/&gt;&quot;).DocumentElement,$true)) 
  }
  
  Write-Host &quot;Update Version.&quot;
  $csprojcontents.SelectNodes(&quot;/Project/PropertyGroup/Version&quot;)[0].InnerText = [version]($ecatBuildNumber)
  
  Write-Host &quot;Save csproj.&quot;
  $csprojcontents.Save($csprojfilename)
  
  &quot;Version number has been updated from &quot; + $oldversionNumber + &quot; to &quot; + $ecatBuildNumber + &quot;.&quot;
  
  Write-Host &quot;WpfApp Versioning Finished&quot;
  </code></pre>
  <p>This is the output I get when using Powershell ISE.</p>
  <blockquote>
  <p>WpfApp Versioning started</p>
  <p>Project file to update
  C:\Users\me\source\repos\mysolution\myapp\myapp.csproj
  Current version number is 6.0.0.6                                   .
  Version is null.</p>
  <p>Name            : Version LocalName       : Version NamespaceURI    :
  Prefix          :  NodeType        : Element ParentNode      :
  PropertyGroup OwnerDocument   : #document IsEmpty         : True
  Attributes      : {} HasAttributes   : False SchemaInfo      :
  System.Xml.XmlName InnerXml        :  InnerText       :  NextSibling<br />
  :  PreviousSibling : Version Value           :  ChildNodes      : {}
  FirstChild      :  LastChild       :  HasChildNodes   : False
  IsReadOnly      : False OuterXml        :  BaseURI<br />
  :  PreviousText    :</p>
  <p>Name            : Version LocalName       : Version NamespaceURI    :
  Prefix          :  NodeType        : Element ParentNode      :
  PropertyGroup OwnerDocument   : #document IsEmpty         : True
  Attributes      : {} HasAttributes   : False SchemaInfo      :
  System.Xml.XmlName InnerXml        :  InnerText       :  NextSibling<br />
  :  PreviousSibling : Version Value           :  ChildNodes      : {}
  FirstChild      :  LastChild       :  HasChildNodes   : False
  IsReadOnly      : False OuterXml        :  BaseURI<br />
  :  PreviousText    :</p>
  <p>Name            : Version LocalName       : Version NamespaceURI    :
  Prefix          :  NodeType        : Element ParentNode      :
  PropertyGroup OwnerDocument   : #document IsEmpty         : True
  Attributes      : {} HasAttributes   : False SchemaInfo      :
  System.Xml.XmlName InnerXml        :  InnerText       :  NextSibling<br />
  :  PreviousSibling : Version Value           :  ChildNodes      : {}
  FirstChild      :  LastChild       :  HasChildNodes   : False
  IsReadOnly      : False OuterXml        :  BaseURI<br />
  :  PreviousText    :</p>
  <p>Name            : Version LocalName       : Version NamespaceURI    :
  Prefix          :  NodeType        : Element ParentNode      :
  PropertyGroup OwnerDocument   : #document IsEmpty         : True
  Attributes      : {} HasAttributes   : False SchemaInfo      :
  System.Xml.XmlName InnerXml        :  InnerText       :  NextSibling<br />
  :  PreviousSibling : Version Value           :  ChildNodes      : {}
  FirstChild      :  LastChild       :  HasChildNodes   : False
  IsReadOnly      : False OuterXml        :  BaseURI<br />
  :  PreviousText    :</p>
  <p>Name            : Version LocalName       : Version NamespaceURI    :
  Prefix          :  NodeType        : Element ParentNode      :
  PropertyGroup OwnerDocument   : #document IsEmpty         : True
  Attributes      : {} HasAttributes   : False SchemaInfo      :
  System.Xml.XmlName InnerXml        :  InnerText       :  NextSibling<br />
  :  PreviousSibling : Version Value           :  ChildNodes      : {}
  FirstChild      :  LastChild       :  HasChildNodes   : False
  IsReadOnly      : False OuterXml        :  BaseURI<br />
  :  PreviousText    :</p>
  <p>Name            : Version LocalName       : Version NamespaceURI    :
  Prefix          :  NodeType        : Element ParentNode      :
  PropertyGroup OwnerDocument   : #document IsEmpty         : True
  Attributes      : {} HasAttributes   : False SchemaInfo      :
  System.Xml.XmlName InnerXml        :  InnerText       :  NextSibling<br />
  :  PreviousSibling : Version Value           :  ChildNodes      : {}
  FirstChild      :  LastChild       :  HasChildNodes   : False
  IsReadOnly      : False OuterXml        :  BaseURI<br />
  :  PreviousText    :</p>
  <p>Update Version. Save csproj. Version number has been updated from
  6.0.0.6                                    to 6.0.0.6.</p>
  <p>WpfApp Versioning Finished</p>
  </blockquote>
  <p>It's strange. How do I get it to stop doing that?</p>