Created
July 28, 2022 13:12
-
-
Save scho/c275c398d94ba8611763ecf5b0abe655 to your computer and use it in GitHub Desktop.
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 | |
# Usage: | |
# install_dependency "FluentAssertions/6.7.0" "net47" | |
function install_dependency() { | |
name=$1 | |
version=$2 | |
dir="NuGet/${name}" | |
echo "Installing ${name}" | |
mkdir -p "${dir}" | |
rm -rf "${dir}/*" | |
curl -sL "https://www.nuget.org/api/v2/package/${name}" --output "${dir}/dependency.zip" | |
unzip -uq "${dir}/dependency.zip" -d "${dir}/" | |
rm "${dir}/dependency.zip" | |
rm -fr "${dir}/package" | |
rm -fr "${dir}/runtimes" | |
rm -fr "${dir}/_rels" | |
rm -fr "${dir}/ref" | |
ls "${dir}/lib" | grep -v "${version}" | xargs -I {} echo "${dir}/lib/"{} | xargs rm -r | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment