Skip to content

Instantly share code, notes, and snippets.

@craigiswayne
Created July 12, 2019 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigiswayne/952c3f11fb45e8bf9eb8232bb6c84795 to your computer and use it in GitHub Desktop.
Save craigiswayne/952c3f11fb45e8bf9eb8232bb6c84795 to your computer and use it in GitHub Desktop.
Build all DotNet Projects in Directory
#!/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