Files
cTrader/scripts/install-dotnet.sh
Brummel 9c39a743d0 Add Linux-native cTrader cBot build/run scaffold
Build cBots in C# and compile them to .algo entirely on Linux via the
official cTrader.Automate NuGet package + 'dotnet build' — no Windows and
no cTrader desktop app. Run/backtest headless through Spotware's official
cTrader console Docker image.

Includes:
- src/SampleCBot: example SMA-crossover cBot (SDK-style net6.0 class library)
- scripts/install-dotnet.sh: root-free local .NET SDK install (~/.dotnet)
- scripts/build.sh: dotnet build -> dist/<ProjectName>.algo, with a workaround
  for cTrader.Automate naming the .algo after the project's parent folder
- scripts/run-console.sh: wrapper over ghcr.io/spotware/ctrader-console
- docs/research-findings.md: sourced research; .algo verified as a proprietary
  'algo'-magic container (not a ZIP); build verified end to end on Linux
2026-06-18 20:54:56 +02:00

38 lines
1013 B
Bash
Executable File

#!/usr/bin/env bash
#
# Install the .NET SDK locally — no root, no system packages — into ~/.dotnet.
# This is the only prerequisite for compiling cBots into .algo files on Linux.
#
# Usage: ./scripts/install-dotnet.sh [channel] # channel defaults to 8.0
#
set -euo pipefail
INSTALL_DIR="${DOTNET_ROOT:-$HOME/.dotnet}"
CHANNEL="${1:-8.0}"
if command -v curl >/dev/null 2>&1; then
curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh
else
wget -qO /tmp/dotnet-install.sh https://dot.net/v1/dotnet-install.sh
fi
bash /tmp/dotnet-install.sh --channel "$CHANNEL" --install-dir "$INSTALL_DIR" --no-path
cat <<EOF
.NET SDK installed to $INSTALL_DIR
Add it to your shell so 'dotnet' is on PATH:
fish:
set -gx DOTNET_ROOT $INSTALL_DIR
fish_add_path $INSTALL_DIR
bash / zsh:
export DOTNET_ROOT="$INSTALL_DIR"
export PATH="\$DOTNET_ROOT:\$PATH"
(The build script picks up ~/.dotnet automatically, so this is only needed for
running 'dotnet' by hand.)
EOF