Jenkins + NUnit with TFS on Build Server - tfs

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

Related

Unable to change MSBuild path in MSBuild Plugin

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.

Jenkins fails to build visual Studio project that runs a batch file in its post build event

I'm new to Jenkins and beginning to setup Jenkins.
I have a Visual Studio project which build fine with post build event that runs a batch script file (copy some files).
However when i build the poject via Jenkins using MSBuild it fails to build the project.
I have also tried to build the project by opening the solution/project from Jenkins workspace and it still fails.
I have no clue as to why this would fails.
Any suggestions or help ?
Post build Event set in visual studio:
call "$(ProjectDir)..\..\dependencies\scripts\postbuild\ExternalStandard.bat" "$(ProjectDir)..\" "$(TargetDir)" "$(Configuration)"
call "$(ProjectDir)..\..\dependencies\scripts\postbuild\CopyDependenciesInternalLicensing.bat" "$(ProjectDir)..\" "$(TargetDir)" "$(Configuration)"
Jenkins build Error:
Try replacing "call" with "cmd /c". "Call" is typically used inside batch files.

Sonarqube with dotnet core works fine on command line but not from Jenkins

I'm trying to launch Sonarqube on a .NET Core 2.0 solution from Jenkins using SOnarQube MsBuild on Windows.
It works fine when i execute the following script from Jenkins workspace:
C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe begin /k:XXXX.Campaigns /n:CI /v: /d:sonar.host.url=http://x.x.x.x:9000 /d:sonar.verbose=true /d:sonar.projectBaseDir="C:\Program Files (x86)\Jenkins\workspace\CI"
dotnet clean
dotnet build
C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe end
But when i execute the same command from Jenkins, i got this message:
The SonarQube MSBuild integration failed: SonarQube was
unable to collect the required information about your projects.
Possible causes:
The project has not been built - the project must be built in
between the begin and end steps.
An unsupported version of MSBuild
has been used to build the project. Currently MSBuild 14.0 upwards
The begin, build or end steps have not all been
launched from the same folder
I use Jenkins 2.46.2 - MSBuild 15 - Sonarqube 6.7 & Sonar MsBuild 4.0.2.892. I tried using Jenkins build steps, command step, command step with a script without success. On a classical .Net 4.5.2 project, it works.
Jenkins was running as local system user. I change it to a normal Windows user and it did the trick. dotnet build was not using Sonarqube dedicated targets.
Thanks you #Valeri!

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.

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

Resources