Msbuild works through VS and on the command line, but not through Jenkins

I am trying to create a VS.SLN that has several C ++. Vcproj in it. The solution file is generated using CMake, and this part works in Jenkins (with the CMake builder plugin). To create a solution file, I use msbuild. I can build the solution using Visual Studio and from the command line using the following command:

C:\Jenkins\workspace\SonioTest>"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /t:Rebuild bin/SonIO.sln

It is being successfully built (on the same machine as Jenkins).

However, I am trying to automate this part of the assembly in Jenkins, and the assembly fails with C1083a couple of errors C1083( "Cannot open source file: '..\path\to\file.ext': No such file or directory). I tried to use both the Jenkins msbuild plugin and the same command that works in the terminal as the “Run Windows batch command” build step, with the same result.

When using the build step of a Windows batch command, I see in the log that the command is executing:

C:\Jenkins\workspace\SonioTest>"C:\Windows\Microsoft.NET\Framework\v4.0.30319 msbuild.exe" /t:Rebuild bin/SonIO.sln

... exactly the same as the one that works from the command line, including the working directory.

I use Jenkins as a service, and I have a service account as my account (with administrator privileges). Does anyone know which directory Jenkins will execute batch commands from?

Any idea why I can see this difference in behavior between Jenkins and the command line?

+5
source share
5 answers

This solution is like a solution, but in the end I used devenvinstead msbuild, and it works great.

, , , VS , , msbuild.

+3

VS, .

- , Jenkins , , .

, , Jenkins .

, , " ".

+1

, , Jenkins , . , , .

To get the slave environment while you work, make a set from the Windows command prompt

+1
source

I can be late for the party, but I still ran into this problem on a new Jenkins installation on Server 2016.

My solution was to use MSBUILD directly from the VS2017 installation C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin. No more mistakes.

0
source

The jenkins assembly needs to use command line arguments. In the .h file, I have a macroC # define REGRESSION_MODE 0 I want to change 1 through jenkins command line arguments and build with 1

0
source

All Articles