Skip to content

Commit b028d64

Browse files
authored
Ensure install script installs .NET 6 runtime when needed (#659)
* Ensure install script installs net6 runtime when needed * Refine configuration helpers for testability
1 parent b246156 commit b028d64

4 files changed

Lines changed: 142 additions & 365 deletions

File tree

.codex/install.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,22 @@ INSTALL_DIR="${DOTNET_INSTALL_DIR:-$HOME/.dotnet}"
99
CHANNEL="${DOTNET_INSTALL_CHANNEL:-6.0}"
1010
BEPINEX_PLUGIN_DIR="${BEPINEX_PLUGIN_DIR:-}"
1111
DOTNET_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"
@@ -34,6 +35,19 @@ else
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
3751
fi
3852

3953
if [ ! -f "$PROJECT_PATH" ]; then

.codex/tests/AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

0 commit comments

Comments
 (0)