in Uncategorized

Peter Provost in love with MSH too

Peter just posted a nice little MSH script for listing out csproj files and their guids. Feeling inspired, here’s one I wrote that helps me find all projects that reference another project:

get-childitem -Include *.csproj -Recurse | where-object { ([xml](get-content $_)).SelectSingleNode(‘//*[local-name() = “ProjectReference”]/*[local-name() = “Name” and text() = “<your project name here>”]’) -ne $null } | sort-object Name | select-object Name

Plop the friendly name of your project into the “<your project name here>” and you can easily find any projects that reference the project you’re lookin’ for. Note I had to use ugly XPath local-name() hacks to get around the fact that otherwise I’d have to pass in an XmlNamespaceManager to SelectSingleNode to map the namespace for MSBuild.

Leave a comment