Last active
December 1, 2023 18:53
-
-
Save stand-sure/465604e314a931d7a9a9e9dfe11bc566 to your computer and use it in GitHub Desktop.
scripts for getting package and project references from csproj files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
for file in src/**/*.csproj | |
do | |
cat $file | \ | |
xq '[(try(.Project.ItemGroup[].PackageReference) // [])] | flatten' | \ | |
jq '[.[].["@Include"]]' | \ | |
jq --arg file ${file} '{"file":$file, "refs":.}' | \ | |
yq eval --prettyPrint '[.]'; | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
for file in src/**/*.csproj | |
do | |
cat $file | \ | |
xq '[(try(.Project.ItemGroup[].ProjectReference) // [])] | flatten' | \ | |
jq '[.[].["@Include"]]' | \ | |
jq --arg file ${file} '{"file":$file, "refs":.}' | \ | |
yq eval --prettyPrint '[.]'; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment