Skip to content

Commit ab11e35

Browse files
Configure the .NET installation directory path externally to ensure the PATH environment variable is shared (#20591)
* Add global.json with sdk version for BuildConfigGen * Set dotnet installation directory from the script and pass to the shell executable Remove global.json * Revert back quotes to a pushd argument
1 parent 42b37cc commit ab11e35

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

BuildConfigGen/dev.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ function detect_platform_and_runtime_id ()
3636
fi
3737
}
3838

39-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
39+
SCRIPT_DIR=$1
4040
pushd "$SCRIPT_DIR"
4141
source "$SCRIPT_DIR/Misc/helpers.sh"
42-
43-
DOTNETSDK_ROOT="$SCRIPT_DIR/_dotnetsdk"
44-
DOTNETSDK_VERSION="8.0.100"
45-
DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION"
42+
DOTNETSDK_INSTALLDIR=$2
43+
DOTNETSDK_VERSION=$3
4644

4745
detect_platform_and_runtime_id
4846
echo "Current platform: $CURRENT_PLATFORM"
@@ -63,10 +61,8 @@ if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTN
6361
# run dotnet-install.ps1 on windows, dotnet-install.sh on linux
6462
if [[ ("$CURRENT_PLATFORM" == "windows") ]]; then
6563
echo "Convert ${DOTNETSDK_INSTALLDIR} to Windows style path"
66-
sdkinstallwindow_path=${DOTNETSDK_INSTALLDIR:1}
67-
sdkinstallwindow_path=${sdkinstallwindow_path:0:1}:${sdkinstallwindow_path:1}
6864
architecture=$( echo $DETECTED_RUNTIME_ID | cut -d "-" -f2)
69-
powershell -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& \"./Misc/dotnet-install.ps1\" -Version ${DOTNETSDK_VERSION} -InstallDir \"${sdkinstallwindow_path}\" -Architecture ${architecture} -NoPath; exit \$LastExitCode;" || checkRC dotnet-install.ps1
65+
powershell -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& \"./Misc/dotnet-install.ps1\" -Version ${DOTNETSDK_VERSION} -InstallDir \"${DOTNETSDK_INSTALLDIR}\" -Architecture ${architecture} -NoPath; exit \$LastExitCode;" || checkRC dotnet-install.ps1
7066
else
7167
bash ./Misc/dotnet-install.sh --version ${DOTNETSDK_VERSION} --install-dir "${DOTNETSDK_INSTALLDIR}" --no-path || checkRC dotnet-install.sh
7268
fi

make-util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1773,8 +1773,12 @@ var ensureBuildConfigGeneratorPrereqs = function (baseConfigToolPath) {
17731773
configToolBuildUtility = path.join(baseConfigToolPath, "dev.sh");
17741774
}
17751775

1776+
const dotnetSdkVersion = "8.0.100";
1777+
const dotnetInstallationDirectory = path.resolve(baseConfigToolPath, "_dotnetsdk", dotnetSdkVersion);
1778+
17761779
// build configToolBuildUtility if needed. (up-to-date check will skip build if not needed)
1777-
run(configToolBuildUtility, true);
1780+
run(`${configToolBuildUtility} ${baseConfigToolPath} ${dotnetInstallationDirectory} ${dotnetSdkVersion}`, true);
1781+
addPath(dotnetInstallationDirectory);
17781782
};
17791783
exports.ensureBuildConfigGeneratorPrereqs = ensureBuildConfigGeneratorPrereqs;
17801784

0 commit comments

Comments
 (0)