@@ -6,18 +6,47 @@ description: Install .NET 9 SDK and restore dependencies for the NLWebNet librar
66
77steps :
88 - name : Install .NET 9 SDK
9- description : Download and install the .NET 9 SDK required for building and running the projects
9+ description : Install the .NET 9 SDK using the official Microsoft installation methods
1010 run : |
11- # Download and install .NET 9 SDK
12- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version latest --channel 9.0
11+ # Check if .NET 9 is already installed
12+ if command -v dotnet &> /dev/null && dotnet --list-sdks | grep -q "9\."; then
13+ echo "✅ .NET 9 SDK is already installed"
14+ dotnet --version
15+ exit 0
16+ fi
17+
18+ # Install .NET 9 SDK using official Microsoft methods
19+ echo "📦 Installing .NET 9 SDK..."
20+
21+ # For Ubuntu/Debian
22+ if command -v apt &> /dev/null; then
23+ # Add Microsoft package repository
24+ wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
25+ sudo dpkg -i packages-microsoft-prod.deb
26+ rm packages-microsoft-prod.deb
27+
28+ # Install .NET 9 SDK
29+ sudo apt update
30+ sudo apt install -y dotnet-sdk-9.0
31+
32+ # For macOS with Homebrew
33+ elif command -v brew &> /dev/null; then
34+ brew install dotnet
1335
14- # Add .NET to PATH if not already present
15- if [[ ":$PATH:" != *":$HOME/.dotnet:"* ]]; then
16- echo 'export PATH="$HOME/.dotnet:$PATH"' >> ~/.bashrc
17- export PATH="$HOME/.dotnet:$PATH"
36+ # For other systems, use the official install script (same as GitHub Actions uses internally)
37+ else
38+ echo "Using official Microsoft .NET install script..."
39+ curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 9.0 --install-dir ~/.dotnet
40+
41+ # Add .NET to PATH if not already present
42+ if [[ ":$PATH:" != *":$HOME/.dotnet:"* ]]; then
43+ echo 'export PATH="$HOME/.dotnet:$PATH"' >> ~/.bashrc
44+ export PATH="$HOME/.dotnet:$PATH"
45+ fi
1846 fi
1947
2048 # Verify installation
49+ echo "🔍 Verifying .NET installation..."
2150 dotnet --version
2251 dotnet --info
2352
0 commit comments