To get csproj files, use Get-ChildItem
Get-ChildItem c:\myProjects *.csproj -recurse
Then you can use for example. Select-Xml as follows:
$ns = @{ defaultNamespace = "http://schemas.microsoft.com/developer/msbuild/2003" } Get-ChildItem c:\myProjects *.csproj -recurse | Select-Xml -xpath '//defaultNamespace:PropertyGroup[1]' -namespace $ns | Select-Object -expand Node
You must fix the default namespace. Right now I do not have a csproj file.
(for more information on xml and xpath in PowerShell, see http://huddledmasses.org/xpath-and-namespaces-in-powershell/ )
Extending the actual node property requires Select-Object .
If you want to work with xml as an object, you can use this:
Get-ChildItem c:\myProjects *.csproj -recurse | % { $content = [xml](gc $_.FullName); $content.Project.PropertyGroup[someindex...] }
source share