XML : How to parse a VS2013 csproj XML file with Powershell to modify the PreBuildEvent

I have been reading up on the Xpath queries (version 2 I think_ used in dotnet, and I still cannot get my script to be able to set the contents of an xml region. How can I do that in powershell? thank you!

  function Get-XmlCsproj {  $toolsPath = "C:\"  [xml] $axml= Get-Content -Path "$toolsPath\csproj03.csproj"    # this outputs the right string ; "SOMETHING", but can't set it equal to a thing   $axml.Project.PropertyGroup.PreBuildEvent     # nil from ;   $axml.SelectSingleNode( "/Project/PropertyGroup/PreBuildEvent")    }  

No comments:

Post a Comment