Reputation: 1196
I have created a pipeline in Jenkins like that:
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\""
}
}
}
}
I have installed MSBuild plugin in Jenkins. In "Global Tool Configuration", I added msbuild path like that: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
In the build stage I am getting this error :
MSBUILD : error MSB1009: Project file does not exist.
When I check Jenkins workspace folder, I can see all project files (.sln and .csproj files). What am I doing wrong?
Upvotes: 0
Views: 980
Reputation: 11
You can try MSBuild path looks like this:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe
Upvotes: 1
Reputation: 633
I think MSBuild comes versioned. Can you check if you have the right path? I have VS2019 as well and my MSBuild path looks like this:
C:\Program Files (x86)\MSBuild\15.0
Upvotes: 0