I've configured the Jenkins MSTestRunner plugin to use the following path to the MSTest executable: 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe'. However, although this path is correct, the build fails as follows:
cmd.exe /C "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" "/resultsfile:/resultsfile testresults" /testcontainer:Project.Tests/bin/Debug/Project.Tests.dll && exit %%ERRORLEVEL%%
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
What's the issue here, I thought this would be the normal way of configuring the MSTestRunner plugin as mstest.exe is installed beneath Visual Studio, which is again typically installed under 'C:\Program Files (X86)'? How do I work around this?
Have received confirmation from the plugin author that MSTestRunner 0.2.0 doesn't handle spaces in MSTest paths. I worked around the issue by instead creating an "Execute Windows batch command" build step in Jenkins that invokes mstest.exe directly, where I've surrounded the mstest.exe path with double quotes:
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testcontainer:Project.Tests\bin\Debug\Project.Tests.dll /resultsfile:testresults.trx
Found that my issue was 2 fold.
File entries are from local workspace dir
You must configure mstest in global tools and then select that instance within the build step.
Related
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.
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
i am trying to execute devenv.exe through windows batch command plugin in Jenkins
but it keeps on executing and fails to launch the application.
Console Output :
**In progressConsole Output
Started by user anonymous
Building on master in workspace C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace
[workspace] $ cmd /c call C:\Windows\TEMP\hudson3900292017086958332.bat
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>set DEVPATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>set PATH=D:\app\nazopay\product\11.2.0\dbhome_1\bin;D:\app\nazopay\product\11.2.0\client_1;C:\Program Files (x86)\Integrity\IntegrityClient10\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\cde\tools;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_23\bin\;C:\Program Files (x86)\Google\Chrome\Application;C:\MingW;C:\PROGRA~2\INTEGR~1\Toolkit\mksnt;%JAVA_HOME%;,;C:\Program Files\Java\jdk1.6.0_23;,;C:\Program Files\Java\jdk1.6.0_23\bin;%CLASS_PATH%;,;C:\Program Files\Java\jdk1.6.0_23\lib;,;C:\Program Files\Java\jdk1.6.0_23\lib;;C:\Program Files (x86)\M**icrosoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>devenv.exe
You must execute devenv.com.
The devenv.exe always attempts to open GUI, even when commands are given, and it can't. The devenv.com has output directed to standard output and works fine from Jenkins.
You also must pass arguments.
Without arguments both devenv.com and devenv.exe just start the IDE GUI, which is not what you want. The correct command-line is
devenv.com projectname.sln /Build Release /Project projectname
First is path to the solution you want to build. Then the /Build flag is followed by configuration. If you have multiple platforms, you have to pass configuration and platform combination, e.g. Release|Win32. The /Project flag names project to build (including all dependencies). If omitted, it builds all projects selected for build in given configuration.
Why don't you use msbuild?
This would be a good starting point for your windows build script:
call "%VS100COMNTOOLS%\vsvars32.bat"
msbuild projectname.sln /target:Rebuild /l:FileLogger,Microsoft.Build.Engine;logfile=msbuild.log || goto error
goto end
:error
#echo ERROR: Build failed
exit/b 1
:end
exit/b 0
This way you can also capture the output log that you can parse with one of the jenkins plugins.
Ofcourse, adjust the VS100COMNTOOLS to your version of MSVS
I'm running into an issue where a 'Execute Windows batch command' build step is failing to find PsExec.
To help narrow down the issue I've created a test project with the following build step:
C:\Windows\System32\PsExec /?
PsExec /?
C:\users\admin\Desktop\PsExec /?
Here are the results:
Building in workspace C:\SoveraHIMDEV-10.2.1
[SoveraHIMDEV-10.2.1] $ cmd /c call C:\Users\admin\AppData\Local\Temp\hudson9054484821341580808.bat
C:\SoveraHIMDEV-10.2.1>C:\Windows\System32\PsExec /?
'C:\Windows\System32\PsExec' is not recognized as an internal or external command,
operable program or batch file.
C:\SoveraHIMDEV-10.2.1>PsExec /?
'PsExec' is not recognized as an internal or external command,
operable program or batch file.
C:\SoveraHIMDEV-10.2.1>C:\users\admin\Desktop\PsExec /?
PsExec v2.0 - Execute processes remotely
Copyright (C) 2001-2013 Mark Russinovich
Sysinternals - www.sysinternals.com
PsExec executes a program on a remote system, where remotely executed console
applications execute interactively.
As you can see, it runs from an absolute path to the desktop, but does not run when just using 'PsExec' or 'C:\Windows\System32\PsExec'. However, all three of these examples execute from the command line correctly.
I've added the PsExec executable to the Jenkins machine's C:\Windows\System32 folder. PsExec works when executing 'PsExec /?' from the command line, and Jenkins shows 'C:\Windows\System32' in its path configurations.
java.library.path:
C:\Program Files (x86)\Jenkins\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\app\admin\product\11.1.0\client_1\bin;C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\apache-maven-3.1.1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Git\cmd;.
Environment Path:
C:\app\admin\product\11.1.0\client_1\bin;C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\apache-maven-3.1.1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Git\cmd
I'm able to run other executables from 'C:\Windows\System32'
What am I missing that stops Jenkins from finding PsExec?
It might be an issue of file system virtualization.
When you copy a file to C:\Windows\System32 it might only be visible for you, not for Jenkins. Copy it to the SysWOW64 folder instead.
Trying to get multiple test categories run via Jenkins mstest plugin command line gives a error
Command line Auguments :/testsettings:Test\Tests\Local.testsettings /category:"!FAIL&!LIVE"
gives
Console output :cmd.exe /C "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /resultsfile:Test\Tests\TestResults\Endpoints\Tests.trx /testsettings:Test\Tests\Local.testsettings /category:!FAIL&!LIVE /testcontainer:Test\Tests\Tests\bin\Endpoints\Tests.dll && exit %%ERRORLEVEL%%
Error:'!LIVE' is not recognized as an internal or external command,
Manual run via cmd : "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /resultsfile:Test\Tests\TestResults\Endpoints\Tests.trx /testsettings:Test\Tests\Local.testsettings /category:!FAIL&!LIVE /testcontainer:Test\Tests\Tests\bin\Endpoints\Tests.dll
This works when run via cmd but not with jenkins plugin
How do I get jenkins plugin not to strip out the quotes ? Or is there any other way.
I think it's a bug related with https://issues.jenkins-ci.org/browse/JENKINS-13412