Skip to content

Instantly share code, notes, and snippets.

@ptdel
Last active August 11, 2020 17:58
Show Gist options
  • Save ptdel/b6085e3ef5bc8a3d5720f2512e25a341 to your computer and use it in GitHub Desktop.
Save ptdel/b6085e3ef5bc8a3d5720f2512e25a341 to your computer and use it in GitHub Desktop.
script for linux to download all nuget package dependencies for a project.
#!/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