I am trying to remove Project/ItemGroup/Reference/Private element from csproj xml.
$csproj = [xml] ( Get-Content $fullProjectPath )
$csproj.Project.ItemGroup |
ForEach-Object { $_.Reference } |
where { $_.Include -match "^(Some).+"} |
ForEach-Object {
if( $_.Private -ne $null ) {
$_.RemoveChild($_.SelectSingleNode("Private"))
}
}
I am getting an error $_.SelectSingleNode("Private"). Why it can find child node Private?