diff --git a/Jenkinsfile b/Jenkinsfile index 236cf52..2944d33 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,9 +3,26 @@ pipeline { environment { DOTNET_CLI_TELEMETRY_OPTOUT = '1' + DOTNET_ROOT = '/var/jenkins_home/.dotnet' + PATH = "${env.DOTNET_ROOT}:${env.PATH}" } stages { + stage('Setup .NET') { + steps { + sh ''' + if [ ! -f "$DOTNET_ROOT/dotnet" ]; then + echo "=== Installing .NET 10 SDK ===" + mkdir -p $DOTNET_ROOT + curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 10.0 --install-dir $DOTNET_ROOT + else + echo ".NET SDK already installed" + fi + dotnet --version + ''' + } + } + stage('Restore') { steps { echo '=== Restore NuGet Packages ===' @@ -16,7 +33,7 @@ pipeline { stage('Build') { steps { echo '=== Build Solution ===' - sh 'dotnet build --no-restore --warnings-as-errors' + sh 'dotnet build --no-restore' } } }