【问题标题】:Jenkins doesn't recognize msbuild.exeJenkins 无法识别 msbuild.exe
【发布时间】: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


    【解决方案1】:
    猜你喜欢
    • 2013-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-27
    • 1970-01-01
    相关资源
    最近更新 更多