Created
July 12, 2019 08:35
-
-
Save craigiswayne/952c3f11fb45e8bf9eb8232bb6c84795 to your computer and use it in GitHub Desktop.
Build all DotNet Projects in Directory
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 | |
########################################################################################### | |
# Find's All *.csproj files in a directory | |
# then executes a dotnet build on that project | |
# if the build fails, it will stop the script execution | |
########################################################################################### | |
separator="==============================================================================="; | |
search="*.csproj" | |
startingDirectory=$PWD; | |
echo $separator; | |
echo "Finding all $search files in $PWD..."; | |
echo $separator; | |
filesFound=$(find "$PWD" -name $search -type f); | |
for i in $filesFound | |
do | |
filename=$(basename $i); | |
echo "Building $filename..." | |
echo ""; | |
cd $(dirname $i); | |
dotnet build; | |
result=$?; | |
echo "Result: $result"; | |
echo ""; | |
if [ $result -gt 0 ] | |
then | |
echo "Failed to build $i"; | |
cd $startingDirectory; | |
break; | |
fi | |
echo $separator; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment