0
votes

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?

2
Did you solve this? Did you check if the path really has the MSBuild.exe?Princy

2 Answers

0
votes

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

0
votes

You can try MSBuild path looks like this:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe