Thursday, September 11, 2014

Thursday Quickie - Which of my packages does my code use?

I had the problem today of wanting to see what versions of my private packages were being used by a specific branch of my codebase.

The solution is a very small powershell script that parses packages.config files and finds the unique dependency packages who's name matches 'MyNamespace'.

Get-ChildItem -recurse -include "packages.config" |  
select-string -pattern "MyNamespace" |
%{ $data = $_ -match 'id="([\w\d.]*)" version="([\d.])*"';    write-output $matches[0] } | 
sort | select -uniq


Quick and simple.

No comments: