diff --git a/src/Layout/redist/dnx b/src/Layout/redist/dnx index 45bff182f77d..184fe80882ac 100755 --- a/src/Layout/redist/dnx +++ b/src/Layout/redist/dnx @@ -3,4 +3,8 @@ # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. -"$(dirname "$0")/dotnet" dnx "$@" +DOTNET="$(dirname "$0")/dotnet" +SDK_VERSION=$("$DOTNET" --list-sdks | tail -1 | cut -d' ' -f1) +SDK_PATH="$(dirname "$0")/sdk/$SDK_VERSION/dotnet.dll" + +"$DOTNET" exec "$SDK_PATH" dnx "$@" \ No newline at end of file diff --git a/src/Layout/redist/dnx.cmd b/src/Layout/redist/dnx.cmd index a1d327f5d6a1..c3433def2147 100644 --- a/src/Layout/redist/dnx.cmd +++ b/src/Layout/redist/dnx.cmd @@ -2,4 +2,16 @@ :: The .NET Foundation licenses this file to you under the MIT license. @echo off -"%~dp0dotnet.exe" dnx %* +setlocal enableextensions + +set "DOTNET=%~dp0dotnet.exe" + +for /f "tokens=1" %%i in ('"%DOTNET%" --list-sdks') do ( + set "SDK_VERSION=%%i" +) + +set "SDK_PATH=%~dp0sdk\%SDK_VERSION%\dotnet.dll" + +"%DOTNET%" exec "%SDK_PATH%" dnx %* + +endlocal