Friday, June 16, 2017

dotnet core + bash

To update all packages in all projects:

find . -name "*.csproj" -exec sh -c "gawk 'match(\$0, /PackageReference Include=\"(.*)\" Version/, a){print a[1]}' {} | xargs -L1 dotnet add {} package" \;

To run all tests in all Tests projects:

find . -name "*Tests*.csproj" -execdir dotnet test --no-build {} \;