#!/bin/bash # chmod a+x /where/i/saved/it/hello_world.sh #### #### This script is by Benjamin Day #### Twitter: @benday #### Website: https://www.benday.com #### #### Feel free to use this script and remember to be nice if it #### doesn't work and remember how much you paid for it. #### if [ $# -ne 2 ] then echo "This script requires two parameters." echo "Parameter 1 is the name of the DLL that contains your migrations without '.dll'. Example: MyApp.Api.dll --> MyApp.Api" echo "Parameter 2 is the name of the startup DLL without '.dll'. Example: MyApp.WebUi.dll --> MyApp.WebUi" exit 1 fi StartupDllName=$2.dll EfMigrationsNamespace=$1 EfMigrationsDllName=$1.dll StartupDllDepsJson=$2.deps.json StartupDllRuntimeConfigJson=$2.runtimeconfig.json DllDir=$PWD # EfMigrationsDllDepsJsonPath=$PWD/bin/$BuildFlavor/netcoreapp1.0/$EfMigrationsDllDepsJson PathToNuGetPackages=$HOME/.nuget/packages NotFound=NotFound PathToEfDll=$NotFound PathToEfDll_Option=$PWD/ef.dll if [ "$PathToEfDll" = "$NotFound" ] then if [ -e $PathToEfDll_Option ] then PathToEfDll=$PathToEfDll_Option fi fi PathToEfDll_Option=/usr/share/dotnet/sdk/2.1.403/DotnetTools/dotnet-ef/2.1.4/tools/netcoreapp2.1/any/tools/netcoreapp2.0/any/ef.dll if [ "$PathToEfDll" = "$NotFound" ] then if [ -e $PathToEfDll_Option ] then PathToEfDll=$PathToEfDll_Option fi fi PathToEfDll_Option=/usr/local/share/dotnet/sdk/2.1.402/DotnetTools/dotnet-ef/2.1.3/tools/netcoreapp2.1/any/tools/netcoreapp2.0/any/ef.dll if [ "$PathToEfDll" = "$NotFound" ] then if [ -e $PathToEfDll_Option ] then PathToEfDll=$PathToEfDll_Option fi fi PathToEfDll_Option=~/.nuget/packages/microsoft.entityframeworkcore.tools/2.1.3/tools/netcoreapp2.0/any/ef.dll if [ "$PathToEfDll" = "$NotFound" ] then if [ -e $PathToEfDll_Option ] then PathToEfDll=$PathToEfDll_Option fi fi PathToEfDll_Option=/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.entityframeworkcore.tools/2.1.1/tools/netcoreapp2.0/any/ef.dll if [ "$PathToEfDll" = "$NotFound" ] then if [ -e $PathToEfDll_Option ] then PathToEfDll=$PathToEfDll_Option fi fi PathToEfDll_Option=~/.nuget/packages/microsoft.entityframeworkcore.tools/2.1.0/tools/netcoreapp2.0/any/ef.dll if [ "$PathToEfDll" = "$NotFound" ] then if [ -e $PathToEfDll_Option ] then PathToEfDll=$PathToEfDll_Option fi fi PathToEfDll_Option=~/.nuget/packages/microsoft.entityframeworkcore.tools/2.0.2/tools/netcoreapp2.0/ef.dll if [ "$PathToEfDll" = "$NotFound" ] then if [ -e $PathToEfDll_Option ] then PathToEfDll=$PathToEfDll_Option fi fi if [ "$PathToEfDll" = "$NotFound" ] then >&2 echo "********************************" >&2 echo " ERROR: COULD NOT LOCATE EF.DLL" >&2 echo "********************************" else echo "Found ef.dll at $PathToEfDll"; echo "Running deployment..."; dotnet exec --depsfile ./$StartupDllDepsJson --runtimeconfig ./$StartupDllRuntimeConfigJson --additionalprobingpath ~/.nuget/packages $PathToEfDll database update --assembly ./$EfMigrationsDllName --project-dir . --verbose --startup-assembly $StartupDllName --root-namespace $EfMigrationsNamespace fi