Files
db-subclass-to-dto/scripts/dotnet.sh
T

29 lines
1005 B
Bash
Executable File

#!/usr/bin/env bash
# Run any dotnet command for this repo.
#
# Why a wrapper:
# - dotnet is installed via mise (see mise.toml, dotnet = "10"); it is NOT on
# PATH in agent/sandbox shells, so plain `dotnet` fails with 127.
# - dotnet SDK 10 fails with "The user's home directory could not be
# determined" unless DOTNET_CLI_HOME is set.
# - The test runner must be invoked from the repo root (the parent directory
# of the test project), so we always cd here first.
#
# Usage: scripts/dotnet.sh <dotnet command and args>
# scripts/dotnet.sh test db-subclass-to-dto.sln
# scripts/dotnet.sh build
set -euo pipefail
cd "$(dirname "$0")/.."
export DOTNET_CLI_HOME="${DOTNET_CLI_HOME:-$HOME/.dotnet-cli}"
export DOTNET_NOLOGO=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
if ! command -v mise >/dev/null 2>&1; then
echo "error: mise not found on PATH; install mise or put dotnet on PATH" >&2
exit 1
fi
if [ "$#" -eq 0 ]; then
exec mise exec -- dotnet --version
fi
exec mise exec -- dotnet "$@"