jenkins - MsBuild 在 Jenkins 上失败
问题描述
我在 Jenkins 中创建了一个这样的管道:
pipeline {
agent any
stages {
stage('Clean') {
steps {
cleanWs()
}
}
stage('Checkout code') {
steps {
git branch: 'test', credentialsId: <credentialsId>, url: <githubUrl>
}
}
stage('Restore Nuget') {
steps {
bat '"C:\\Nuget\\nuget.exe" restore <ProjectName>.sln'
}
}
stage('Build') {
steps {
bat "\"${tool 'MSBuild'}\" <ProjectName>.sln /p:Configuration=Release;Platform=\"Any CPU\""
}
}
}
}
我已经在 Jenkins 中安装了 MSBuild 插件。在“全局工具配置”中,我添加了这样的 msbuild 路径:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
在构建阶段,我收到此错误:
MSBUILD:错误 MSB1009:项目文件不存在。
当我检查 Jenkins 工作区文件夹时,我可以看到所有项目文件(.sln 和 .csproj 文件)。我究竟做错了什么?
解决方案
您可以尝试 MSBuild 路径如下所示:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe
推荐阅读
- ios - 添加 UISearchController 时导航栏变为白色
- python - Selenium 表搜索未返回正确的文本
- react-native - 终端安装小东西需要太多时间
- c# - 如何使用 Angular 取消 .Net Core Web API 请求?
- angular - 如果我可以使用结构指令控制 DOM 内容,为什么还要使用 Route Resolver?
- signalr - SinglR 通知不显示 MVC
- jbehave - 我们如何在不创建新浏览器实例的 jbehave 故事中调用子故事?
- ios - 如何正确编写 MSHook 和 MSHookIvar
- python - 为什么不重写文件 .txt 文件中的文本,即使代码处理正确?
- json - React - 使用其名称/值从数组中删除项目