Tuesday, June 16, 2009
« Changing ODC links in Excel Services fro... | Main |

You know how it is, you start developing a project and then 6 months later you look back and realise you have to document everything you've produced.

I've just gone through that process and need a quick list of all the features ids scattered around various subdirectories of a large project.

sample:

<Feature  Id="886f12cf-97ca-4789-baf8-6f13f9f2cedf"
          Title="PGPSO Contract Management Project Upgrade"
          Description="Feature that upgrades Project Sites for Contract Management."
          Version="12.0.0.0"
          Hidden="FALSE"
          Scope="Web"
          DefaultResourceFile="core"
          ReceiverAssembly="PGPSO_CM_Project_Upgrade, Version=1.0.0.0, Culture=neutral, PublicKeyToken=aa0408b86137366a"
          ReceiverClass="PGPSO_CM_Project_Upgrade.PGPSO_CM_Project_Upgrade"
          xmlns="http://schemas.microsoft.com/sharepoint/">

Firing up Powershell navigating to the root of the solution folders and running this command gets me the list

gci -recurse -filter  feature.xml | % { $contents=get-content $_.fullname; $x=[XML]$contents; "{0} {1}" -f $x.Feature.Id, $x.feature.title }

result:

 

gci is an alias for get-childitem which allow you to recurse subfolders and provide a filter parameter. Then use get-content to open the file, convert to an XML object and then directly reference the Id and title of the feature.xml file.