Last active
August 11, 2020 17:58
-
-
Save ptdel/b6085e3ef5bc8a3d5720f2512e25a341 to your computer and use it in GitHub Desktop.
script for linux to download all nuget package dependencies for a project.
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
#!/bin/bash | |
# downloads all dependencies for a project via nuget. | |
# useful for vscode users on linux. | |
regex='PackageReference Include="([^"]*)" Version="([^"]*)"' | |
find . -name "*.*proj" | while read proj | |
do | |
while read line | |
do | |
if [[ $line =~ $regex ]] | |
then | |
name="${BASH_REMATCH[1]}" | |
version="${BASH_REMATCH[2]}" | |
if [[ $version != *-* ]] | |
then | |
dotnet add $proj package $name | |
fi | |
fi | |
done < $proj | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment