Setting up a Pipeline build in Jenkins (Jenkins 2.6), copying the sample script for a git-based build gives: \"no tool named MSBuild found\". I have set MSBuild Tool in Ma
In Declarative Pipeline syntax, the tooling for MSBuild is a little clunkier. Here's how I've had to handle it, using a script
block:
pipeline {
agent {
label 'win-slave-node'
}
stages {
stage('Build') {
steps {
script {
def msbuild = tool name: 'MSBuild', type: 'hudson.plugins.msbuild.MsBuildInstallation'
bat "${msbuild} SimpleWindowsProject.sln"
}
}
}
}
}
In the older Scripted Pipeline syntax, it could be like this:
node('win-slave-node') {
def msbuild = tool name: 'MSBuild', type: 'hudson.plugins.msbuild.MsBuildInstallation'
stage('Checkout') {
checkout scm
}
stage('Build') {
bat "${msbuild} SimpleWindowsProject.sln"
}
}