@@ -9,21 +9,22 @@ INSTALL_DIR="${DOTNET_INSTALL_DIR:-$HOME/.dotnet}"
99CHANNEL=" ${DOTNET_INSTALL_CHANNEL:- 6.0} "
1010BEPINEX_PLUGIN_DIR=" ${BEPINEX_PLUGIN_DIR:- } "
1111DOTNET_INSTALLED=0
12+ REQUIRED_RUNTIME=" Microsoft.NETCore.App 6.0"
1213
13- if command -v dotnet > /dev/null 2>&1 ; then
14- echo " .NET SDK already installed: $( dotnet --version) "
15- DOTNET_INSTALLED=1
16- else
14+ install_dotnet () {
1715 mkdir -p " $INSTALL_DIR "
18- INSTALL_SCRIPT= " $( mktemp ) "
19- trap ' rm -f "$INSTALL_SCRIPT" ' EXIT
16+ local install_script
17+ install_script= " $( mktemp ) "
2018
21- curl -sSL https://dot.net/v1/dotnet-install.sh -o " $INSTALL_SCRIPT "
19+ curl -sSL https://dot.net/v1/dotnet-install.sh -o " $install_script "
2220
23- bash " $INSTALL_SCRIPT " --install-dir " $INSTALL_DIR " --channel " $CHANNEL "
21+ bash " $install_script " --install-dir " $INSTALL_DIR " --channel " $CHANNEL "
22+
23+ rm -f " $install_script "
2424
2525 export DOTNET_ROOT=" $INSTALL_DIR "
2626 export PATH=" $INSTALL_DIR :$INSTALL_DIR /tools:$PATH "
27+ hash -r
2728
2829 if command -v dotnet > /dev/null 2>&1 ; then
2930 echo " Installed .NET SDK $( dotnet --version) to $INSTALL_DIR "
3435 echo " Installation completed but dotnet is not on PATH. Add $INSTALL_DIR to PATH manually." >&2
3536 exit 1
3637 fi
38+ }
39+
40+ if command -v dotnet > /dev/null 2>&1 ; then
41+ echo " .NET SDK already installed: $( dotnet --version) "
42+ # Inspect the installed runtimes to ensure the required Microsoft.NETCore.App 6.0 runtime is available.
43+ if dotnet --list-runtimes 2> /dev/null | grep -q " ^Microsoft.NETCore.App 6\\ .0" ; then
44+ DOTNET_INSTALLED=1
45+ else
46+ echo " Microsoft.NETCore.App 6.0 runtime not found; installing local runtime into $INSTALL_DIR "
47+ install_dotnet
48+ fi
49+ else
50+ install_dotnet
3751fi
3852
3953if [ ! -f " $PROJECT_PATH " ]; then
0 commit comments