我正在尝试在 Jenkins 上创建一个管道,以自动化我的构建、测试和部署过程。
pipeline {
agent any
environment {
myVersion = '0.9'
}
tools {
msbuild '.NET Core 2.0.0'
}
stages {
stage('checkout') {
steps {
checkout([$class: 'GitSCM', ...])
}
}
stage('restore') {
steps {
bat 'dotnet restore --configfile NuGet.Config'
}
}
stage('build') {
steps {
bat 'dotnet build'
}
}
stage('publish') {
steps {
...
}
}
}
}
尝试运行构建时,我从 Jenkins 收到此错误消息:
'dotnet' 未被识别为内部或外部命令, 可运行的程序或批处理文件。
我必须改变什么才能让这个环境正常工作?
我将我的 .NET CORE 路径等添加到 MSBuild 的 Jenkins 设置中。
我错过了什么?
最佳答案
这样解决的:
environment {
myVersion = '0.9'
dotnet = 'path\to\dotnet.exe'
}
然后用 %dotnet%
变量替换了我的命令。
关于c# - 如何使用 ASP .NET Core 设置 Jenkins,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46430469/