【发布时间】:2022-12-17 23:00:35
【问题描述】:
我刚开始使用 Jenkins 并遵循本教程:https://medium.com/southworks/creating-a-jenkins-pipeline-for-a-net-core-application-937a2165b073
我已经到了清理解决方案的地步,但我收到错误消息:“msbuild.exe”未被识别为内部或外部命令, 可运行的程序或批处理文件。
到目前为止,这是我的 Jenkinsfile:
pipeline {
agent any
stages {
stage ('Clean workspace') {
steps {
cleanWs()
}
}
stage ('Checkout git') {
steps {
git credentialsId: 'jenkins_id', url: 'https://github.com/org/project.git', branch: 'feature-branch'
}
}
stage('NuGet restore') {
steps {
bat "dotnet restore ${workspace}\\solution.sln"
}
}
stage('Clean solution') {
steps {
bat "msbuild.exe ${workspace}\\solution.sln -nologo -nr:false -p:platform=\"x64\" -p:configuration=\"release\" -t:clean"
}
}
}
}
这就是我在 Jenkins 中配置 MSBuild 的方式:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin 也添加到我的 Path 变量中,我有一个具有相同值的 msbuild 系统变量。
我不知道这是否重要,但我正在使用 Rider for IDE。
有人知道为什么 Jenkins 找不到 msbuild 吗?
谢谢
【问题讨论】:
标签: .net jenkins msbuild jenkins-pipeline