Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/Layout/redist/dnx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.

DOTNET="$(dirname "$0")/dotnet"
SDK_VERSION=$("$DOTNET" --list-sdks | tail -1 | cut -d' ' -f1)
SDK_PATH="$(dirname "$0")/sdk/$SDK_VERSION/dotnet.dll"
# Resolve symlinks portably (macOS's BSD readlink does not support -f).
SCRIPT="$0"
while [ -L "$SCRIPT" ]; do
LINK=$(readlink "$SCRIPT")
case "$LINK" in
/*) SCRIPT="$LINK" ;;
*) SCRIPT="$(dirname "$SCRIPT")/$LINK" ;;
esac
done
DIR="$(cd "$(dirname "$SCRIPT")" && pwd -P)"

"$DOTNET" exec "$SDK_PATH" dnx "$@"
DOTNET="$DIR/dotnet"
SDK_VERSION=$("$DOTNET" --list-sdks | tail -n 1 | cut -d' ' -f1)
if [ -z "$SDK_VERSION" ]; then
echo "Error: dnx requires a .NET SDK to be installed, but none was found." >&2
exit 1
fi
SDK_PATH="$DIR/sdk/$SDK_VERSION/dotnet.dll"

exec "$DOTNET" exec "$SDK_PATH" dnx "$@"
Loading