Unable to change MSBuild path in MSBuild Plugin - jenkins

I have added my MSBuild v.16 to my path parameter on my windows machine.
If I run the NuGet restore for my project from my cmd, it works correctly.
If I run this command from my local jenkins, it picks the MSBuild v.14 under auto detect.
I tried giving the path to MSBuild in jenkins Global Configuration MSBuild but it does not resolve the problem.

Related

configuring jenkins msbuild path

I have configured a new msbuild path and name
in the jenkins configure tool. The configuration pointing to v15
I receive thew following error:
C:\jenkins_slave\cortana\workspace\xxx\testing>exit 0 FATAL:
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Professional\MSBuild\15.0\Bin doesn't exist Build step
'Build a Visual Studio project or solution using MSBuild' marked build
as failure
How can I solve it?
In second screenshot you need to put slash at the end of the path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\
However, to use Jenkins MSBuild plugin for VS2017 there are other things to consider. Launching MSBuild executable in my case required bunch of environment variables to be configured which otherwise are set in "Development Command Prompt".
I am contemplating using "dotnet build", "dotnet test" etc. in command line instead.

command not found when executed from jenkins, but runs on mac agent

I have Jenkins set up on a Windows machine, with a mac slave configured.
When I run the command nuget directly from terminal, it works. However when I try running the nuget command from Jenkins as a executable shell, I get command not found
[iOS Build] $ /bin/sh -xe /var/folders/hr/b_p9skp53178b45895w2htw80000gn/T/hudson278562289764277217.sh
+ nuget restore '/Users/a/Jenkins/workspace/iOS Build/App/Acquaint.Native.sln'
/var/folders/hr/b_p9skp53178b45895w2htw80000gn/T/hudson278562289764277217.sh: line 2: nuget: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I already have the directory where nuget resides configured in the PATH environment variable
maybe:
echo $PATH within your job to ensure it's configured as you expect when the job runs.
try including the full path to nuget. run /usr/local/bin/nuget restore... (or wherever nuget is found) instead of nuget restore... to determine if it's really a PATH issue.

Call executables in the Windows folder from Jenkins shell step

I would like to call MSBuild in Jenkins, in a shell step. Although from what I recall; you can access only the workspace folder, which is what is allowed in Jenkins.
How do you actually build in Windows environment, when using Jenkins, if your build tool is in Windows\Microsoft.NET\Framework ?
Although from what I recall; you can access only the workspace folder, which is what is allowed in Jenkins.
That is true for the source on which your command (here MSBuild) will operate on.
But the command itself can be called (from a build step) with its full path, even though said full path is outside the local workspace.
Or you can specify that installation path through the Jenkins MSBuild Plugin.
To use this plugin, specify the location directory of MSBuild.exe on Jenkin's configuration page.
The MSBuild executable is usually situated in a subfolder of C:\WINDOWS\Microsoft.NET\Framework. If you have multiple MSBuild versions installed, you can configure multiple executables.
Then, on your project configuration page, specify the name of the build file (.proj or .sln) and any command line
arguments you want to pass in. The files are compiled to the directory where Visual Studio would put them as well.

MSBuild configuration in jenkins

I am facing the error below during configuration of MSBuild in Jenkins:
[ImageResize] $ cmd.exe /C " msbuild.exe p:Configuration=Release
E:\Heena\Applications\ImageResize\vbimage\ImageResize.sln " && exit
%%ERRORLEVEL%% 'msbuild.exe' is not recognized as an internal or
external command, operable program or batch file. Build step 'Build a
Visual Studio project or solution using MSBuild' marked build as
failure Finished: FAILURE
Please note that I have set MSBuild path up to msBuild.exe during setting up of MSbuild plugin. I have successfully deployed Visual Studio project on jenkins, but unable to configure it with MSBuild.
In MSBuild installations option of jenkins,
Choose the path to MSBuild = C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Then go to your respective jenkins project where you want to build,
from,Add Build Step menu choose
Build Visual Studio Project or solution using MSBuild option
MSBuild version will be what you defined in Step 1 and in MSBuild File
type the path of your solution file and in Command Line Arguments option
type /p:Configuration=Release.
Hope you got the answer what you were looking for.
A Guess from my side , msbuild.exe is not part of the PATH when you execute the msbuild command , check that before you run the command , try to export the the path to msbuild to the path variable.
Looking at the error i assume you are using windows/Batch , so try some thing like this before running msbuild
set PATH=%PATH%;path/to/msbuild/binary
Feel free to revert in case of any issues/concerns

Jenkins + NUnit with TFS on Build Server

I'm new to continuous integration. I'm trying to get Jenkins to execute unit tests from a TFS project. My Jenkins build (pre-NUnit build step) is successful and I've installed the NUnit Jenkins plugin and I've read this post, but it's failing with this error: "The system cannot find the path specified."
I think the trouble is that I'm NOT running from my local machine, so the test DLL that NUnit should be running is missing I think. How can I reference that DLL properly? Do I need an extra Build Step to copy the files or something? Here's my "Execute Windows Batch Command" build step command:
"C:\Program Files\NUnit 2.6.3\bin\nunit-console.exe Victoria.Tests.Integration/bin/Debug/Victoria.Tests.Integration.dll /xml=nunit-result.xml"
The problem is that your command is all in quotes, including the parameters.
Change
"C:\Program Files\NUnit 2.6.3\bin\nunit-console.exe Victoria.Tests.Integration/bin/Debug/Victoria.Tests.Integration.dll /xml=nunit-result.xml"
to
"C:\Program Files\NUnit 2.6.3\bin\nunit-console.exe" Victoria.Tests.Integration/bin/Debug/Victoria.Tests.Integration.dll /xml=nunit-result.xml

Resources