Automatically exit Visual Build Professional tool when build is done? - visual-build-professional

Visual Build Professional has an [Exit] action but it only terminates the build currently in progress. Is there any way for it to terminate the entire build tool?
I have a frequently run build script which I usually let run in the background, and it would be convenient if the tool would clean itself up by terminating altogether once this build is done.

Include the /s flag when starting VisBuildPro.exe (if using a VisBuildPro Project action, check 'Run GUI App in silent mode' on the Project tab) so that it will exit after the build finishes.
https://kinook.com/VisBuildPro/Manual/command_linegui.htm
You may also want to check 'Tools | User Options | Build | Honor command-line switches if build fails/canceled and continued'.
https://kinook.com/VisBuildPro/Manual/builduseropt.htm

Similar to running the GUI tool with a command line, another possibility is to run the build script using the VisBuildCmd.exe command line executor.
Details: https://www.kinook.com/VisBuildPro/Manual/index.htm?consoleapp.htm
This does not quite meet the question's objective of having the script itself cause the build tool to terminate, and would require either running the command manually at a prompt or otherwise scripting it like with a batch file. However once setup this achieves nearly the same result.

Related

TFS Build: stuck when running .exe

I run BUILD in TFS, and one of the steps contains executing the .exe file.
If i run this .exe file separately, on the remote PC where BUILD is running, it operates correctly and successfully.
But when it is being called from BUILD, it simply gets stuck on this stage.
I used debug mode, copied exactly the command it is running of this type:
C:\Windows\system32\cmd.exe /c "C:\Agents\Agent2.....<my path>...\my_file.exe"
Copied it, used the Win+R (run), pasted - it works perfectly.
When can't the BUILD run the .exe file?
Thanks.
I suppose because the application is trying to do something UI-y. The agent is running as a service and any application running during the build should not use the UI in any way. Anything that relies on Windows Forms, WPF or the Message Pump won't work as long as the agent isn't running Interactively.
Try running the exact command from a scheduled task, that should also allow you to test non-interactively.

Play framework services integration testing in Jenkins CI

I want to use Jenkins CI for integration testing with Play framework. My scenario is as following:
I have 2 projects, Project A and B.
Project A depends on Project B. The dependency is as such that to run tests on Project A, I need to start Project B first.
I already have unit tests in Project A but I need to test the integration of Project A and B.
I am using SBT plugin to execute the SBT and the Project A and Project B are working fine separately.
I could not figure out a proper way to do it. The issue I am facing is that I need to run Project B as a pre-build step but the Project B must be kept in running state but Project B is ended as soon as the build step executes run action of sbt and finishes the build which I don't want.
The command I execute to run Project B is clean compile run which executes as an action to SBT launcher.
I tried SBT stage and then run the jar but that is also causing the issue that the jar halts the control of the build and Project A doesn't get a chance to start.
I also checked Spawning a process in Jenkins but I couldn't make it work too. I am using Ubuntu and I tried using nohup instead of daemonize as described in the link by adding it as Execute shell script build step and it starts the Project B server process and kills it after some time. I also don't think that it might be the only way to do what I want to do.
May be I am using Jenkins wrong or may be I need to look in another direction so any help on this is much appreciated.
I ran into a similar problem where I needed to free the console for running other stuff. I did something similar (i.e. creating a script with the sbt commands), then running the script with a nohup like so:
nohup ./myScript.sh &
and the Play! app runs just fine in the background.
Remember to use different ports in your case, since you're running two Play! apps.

MSBuild - Jenkins - Nuget integration

We are experiencing some weird behavior using Jenkins and MSBuild.
When manually typing into a command line to build a build.xml project:
msbuild build.xml /T:Package /P:PublishProfile=Test /P:Platform="AnyCPU"
/P:VisualStudioVersion=12.0
The build process works exactly as expected (build, packaging, etc.)
However, if I am using Jenkins to do exactly this - that is - open a command line and run this exact command, I get an error saying:
The command ""..\.nuget\NuGet.exe" install
"C:\Jenkins\jobs\.....\workspace\MYPROJECT\packages.config"
-source "" -NonInteractive -RequireConsent -solutionDir "..\ "" exited with code 1
Even if I am using the built-in jenkins plugin to run the command (regardless which parma combination I use), it still doesn't.
I know two of the following sounds like a solution, but they don't work:
Permissions! - My server always runs as admin.
Enabling package restoring on NuGet from VS - Already did!
Any idea will be great!!!
Here is the answer, it took a long time to solve, and thanks to #adarshr I came to realize the problem is because of the difference between the Jenkins runner's user (i.e the jenkins Service) and my user. To resolve this issue I've made Jenkins running as the same user and all good!
Step by step:
Go to Control Panel -> System and Security -> Administrative Tools
Click on the Services shortcut.
Right click on the Jenkins service and select Properties.
Navigate to the Log On tab.
Click on run as this user and fill in your credentials.
Restart Jenkins.
Works like a charm!

How to Invoke and Kill Executable in TFS Build Definition?

I am developing a Web API solution. This EXE listens and responds to localhost:8080/abc/.
I have developed a Test solution for this executable.These tests simply verify responses from localhost:8080/abc/.
I have already successfully created a build definition that:
Gets and compiles the solution.
Gets and compiles the tests.
Runs the tests.
My problem here is, the tests are failing, because the EXE isn't up and running. How do I bring up the EXE for the tests, and kill it after the tests are done? Could this be done solely in the build definition itself? Say via MSBuild Arguments in the "Build process parameters"? Hopefully there is a simple solution to this...
Thanks in advance!
I can't manage to solve this in the build definition alone.
I found the solution in modifying the build template (via Edit Build Definition... -> Process), by adding InvokeProcess controls in the build flow. Have these controls call BAT files that instead run / kill the EXE.

Jenkins on Windows using something other than ant

I am looking at using Jenkins on Windows.
I currently have an ant script. It works pretty well. Except for instance, when the build breaks because of a syntax error, I can not see the error in the Jenkins console log.
So I am thinking may be ant is not the best tool for use on Windows.
What do most of you use for Jenkins on Windows?
If it is ant, how do you send the build output, VStudio, to the Jenkins console?
Thanks
Primarily I use Jenkins with maven projects, although you should see the ANT output in the online logs regardless.
What are you building? Are you building Java projects? Ant is what you use. If you are bulding a C project, you should use Make. If you're building a VisualStudio project, you should use msbuild. You use the build tool for your project. Jenkins will execute them without a problem.
Take a look at the build in question. On the left side of the screen, there's a Console output item. Click on that. Is there any output. No matter what tool you use, Jenkins captures the STDOUT and STDERR in that console output. If nothing else, you should see the exact commands Jenkins is executing to checkout and to build your project. Try executing those commands.
Still, you didn't give us much to go on. No idea what you're building or what you're doing with Ant. You didn't state any error, the console output, or even what the Jenkins error log is stating.
Jenkins does two things:
It watches your repository for changes.
Once it detects the changes, it executes the very commands you'd execute to build the project.
Jenkins doesn't care whether you use Ant, Maven, Make, or simply do a del /s/q. Jenkins will simply execute the commands you tell it to execute.
Addendum
It is c, c++, Java and InstallShield. I use ant to do file copy and move, call msdev.exe project. Some Javac calls, InstallShield command line builds..
Jenkins can execute multiple step builds in a single job. After you specify the build step, you can press the Add button to add another build step. There's no reason that all the build steps even have to be of the same type. Just select a "Freestyle" build, and use the right build tools for the job.
There's an optional MSBUILD plugin in Jenkins that should do your MS Build. This should give you the complete output from MSBuild, so you can see any errors.
After you do your MSBuild step, you can create a second build step to run an Ant task to build your InstallShield. After that, you could run another build step to do the copying you need either on the command line or through something like Ant (or Nant.
Whatever the output of the various tools is the output you'll get in the build console.
dev.cmd shows the output and I continue to use ant.

Resources