Skip to content

Instantly share code, notes, and snippets.

@SergioRibera
Created February 3, 2021 00:25
Show Gist options
  • Save SergioRibera/744570d6decec0a6e280ac0931cf82ca to your computer and use it in GitHub Desktop.
Save SergioRibera/744570d6decec0a6e280ac0931cf82ca to your computer and use it in GitHub Desktop.
This simple script allows to compile dotnet for all platforms, windows (x86 and x64), linux (x64), mac (Minimum OS version is macOS 10.12 Sierra) and arm (x86 and x64). to run this script you must give it run permissions with `chmod +x compile.sh`. To run it the first parameter must be the path to the folder where the dotnet project is located (…
#!/bin/bash
rm -rf $2
cd $1
BLUE='\033[0;34m'
NC='\033[0m'
printf "${BLUE}\n"
printf " ____ ___ \n"
printf " / ___| / |\n"
printf " __ _/ /___ / /| |\n"
printf " \ \/ / ___ \/ /_| |\n"
printf " > <| \_/ |\___ |\n"
printf " /_/\_\_____/ |_/\n"
printf " \n"
printf "${NC}\n"
printf "${BLUE}Start Compiling For Linux x64${NC}\n"
dotnet publish -c Release -r linux-x64 -o $2/x64/linux -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=true
printf "${BLUE}Start Compiling For Windows x64${NC}\n"
dotnet publish -c Release -r win-x64 -o $2/x64/win -p:PublishSingleFile=true -p:PublishTrimmed=true
printf "${BLUE}Start Compiling For Mac x64 (Minimum OS version is macOS 10.12 Sierra)${NC}\n"
dotnet publish -c Release -r osx-x64 -o $2/x64/mac -p:PublishSingleFile=true -p:PublishTrimmed=true
printf "${BLUE}\n"
printf " ___ __ \n"
printf " / _ \ / / \n"
printf " __ _| (_) |/ /_ \n"
printf " \ \/ /> _ <| '_ \ \n"
printf " > <| (_) | (_) |\n"
printf " /_/\_\____/ \___/ \n"
printf " \n"
printf "${NC}\n"
printf "${BLUE}Start Compiling For Windows x86${NC}\n"
dotnet publish -c Release -r win-x86 -o $2/x86/win-x86 -p:PublishSingleFile=true -p:PublishTrimmed=true
printf "${BLUE}\n"
printf " _____ __ __ \n"
printf " /\ | __ \| \/ |\n"
printf " / \ | |__) | \ / |\n"
printf " / /\ \ | _ /| |\/| |\n"
printf " / ____ \| | \ \| | | |\n"
printf " /_/ \_\_| \_\_| |_|\n"
printf " \n"
printf "${NC}\n"
printf "${BLUE}Start Compiling For Linx Arm 64 bits and Raspberry Pi 3+${NC}\n"
dotnet publish -c Release -r linux-arm64 -o $2/arm/arm-x64 -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=true
printf "${BLUE}Start Compiling For Linx Arm and Raspberry Pi 2+${NC}\n"
dotnet publish -c Release -r linux-arm -o $2/arm/arm -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment