pipeline {
agent any

// If using the .NET SDK plugin, wrap steps in this block
/* 
tools {
    dotnetsdk 'dotnet-8' 
}
*/

stages {
    stage('Checkout') {
        steps {
            git  branch: 'main',
                url:'https://github.com/congduan2811/DemoJenkins.git'
        }
    }

   stage('Restore') {
        steps {
            sh 'dotnet restore' // Use 'bat' for Windows
        }
    }
    stage('Build') {
        steps {
            sh 'dotnet build --configuration Release'
        }
    }
    stage('Test') {
        steps {
            sh 'dotnet test'
        }
    }
    stage('Publish') {
        steps {
            sh 'dotnet publish -c Release -o ./publish'
        }
    }
}

}