Exec task in msbuild TFS won't execute exe properly - tfs

I'm using web deploy to a remote server, through which we can only connect through a Cisco VPN client.
In my TFS project file I have an EXEC task to open the client, then one to close it.
<Exec Command="start $(COMSPEC) /C "C:\Program Files (x86)\Cisco Systems\VPN Client\vpnclient.exe" connect profile user me pwd password" ContinueOnError="false" />
Without these EXEC tasks and if I open the connection manually then the deployment works. But these commands aren't opening the client in the build, it just hangs on this task before opening the client.
If I copy this task and paste into a standard build file and call that from msbuild.exe then the client is opened.
Do you know why it won't work in the TFS project when the build is called but it would work manually in a separate build file?

For kicks I would try using the full path to comspec: "C:\Windows\system32\cmd.exe" or whatever path for the OS you are using in the off-chance it is resolving incorrectly.
Also, can you toss in a /k to keep the cmd prompt open and see what, if any, errors show assuming it launches correctly?

I couldn't work this one out. So I used Invoke Process in the XAML template instead. Which has worked fine.

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.

launch a .bat in TFS2015 build

I have a problem trying to launch a server via a .bat file during a TFS build.
I usually launch the server via a cmd window and it works fine.
When I set it in the TFS build, I end up with the following message :
"'..\server_common.bat' is not recognized as an internal command or external, an executable or a command file".
I also have the following line:
"java -Dsun.lang.ClassLoader.allowArraySyntax=true -Xbootclasspath/a:..\..\..\lib\framework\serverjvm15.jar; -cp ..\..\..\lib\framework\fwtime.jar;" indicating a java syntax error (? I'm not skilled in java)
This batch calls other .bat files and sets java VM-related environment variables
From my research, it is probably a problem of rights as I don't have admin rights when I use TFS. However, all the other steps in the build work fine (installing and launching an appli through command lines, or launching a python script via command lines).
However I also tried to launch a basic script with the same kind of step and it works.
First, suggest you to follow the tutorial in Batch script. Make sure you have meet the requirements of Arguments and used correctly. Such as
Path
Specify the path to the .bat or .cmd script you want to run. The path
must be a fully qualified path or a valid path relative to
the default working directory. In Team Foundation Build, this
directory is $(Build.SourcesDirectory).
Also RDP to your build agent and use your build service account manually run the server_common.bat to narrow down if the account have enough permission.

failure to launch exe from ant

I am using Jenkins to run an Ant script which in turn launches an exe. The exe fails to launch. I get no results at all. The exe opens fine on the server without Jenkins via Ant. Other exe files do seem to launch OK. The only thing I can see that is different is that my problematic exe opens a dialog which then automatically closes. Does anyone have an idea how to get Jenkins to launch my exe? Is there some setting or parameter I am missing?
I am calling the exe with the exec task and passing in arguments.
If I try to run the exe directly from Jenkins using "Execute Windows Batch Command" I also get no results.
Thanks for your help.
once I set the Jenkins service to run under a real login instead of just using the system account, the application runs.

How to open an external executable file using jenkins

How to open an external executable file using jenkins
I tried it in execute window batch command like
cd c:\EMailer\
call testcompete.exe
But it is not working
then i tried
start testcomplete.exe
This testcomplete will run the automated site and write a text file .
It is also not working.Is there any pluggin or method in jenkin to open external executable files?
showing prompt when testcomplete trying to start
Set the Jenkins service to "Allow service to interact with the desktop". This will allow Jenkins to use the desktop as a resource.
You need to install Windows Exe Runner Plugin in Jenkins.
For more information: https://wiki.jenkins.io/display/JENKINS/Windows+Exe+Runner+Plugin

Creation of InstallAnywhere installer inside of Hudson CI

My company is trying to automate the creation of a nightly installer with Hudson. Our license to install anywhere is running on a separate server. We have an ANT build script set up to call the InstallAnywhere jar file which creates the installer automatically, and that works great when ran from the command prompt.
However when we try to run it inside of Hudson, Hudson is not able to connect to that license server. InstallAnywhere spits out The evaluation period has expired. Does anyone know what we can do to solve this issue?
I'm assuming it's a Hudson issue since our ANT script works fine when used outside of Hudson.
My best guess is that you need to set up some environment variables required by the InstallAnywhere process; I'm not very familiar with that product, but maybe it needs a home directory for the product, the location of the license file, the license key value, etc.
One easy way to debug this would be to check if Hudson is running under the same user that you are using to run the Ant script from the command line, then check the environment settings for the command line user if they are different.
Since I'm running Hudson as a service I had to use the "Default User" user. The solution was to copy the InstallAnywhere folder tree from "C:\Documents and Settings\MyUser" to "C:\Documents and Settings\Default User"
I just had the same issue, so I thought I would share my solution. You can also register the CI build user so you can continue using the automated user rather than switching it to your own user account: http://www.flexerasoftware.com/downloads/instructions/productlicensing/en/InstallAnywhereProductLicensing.pdf#page=15
Set up a bat file to execute:
<PATH_TO_IA>\build.exe -registerNodeLocked <PATH_TO_IA>\License.lic
Note, the License will be your mac address.lic, and you only have to do this once.
My bat was:
C:\Progra~2\Instal~2\build.exe -registerNodeLocked C:\Progra~2\Instal~2\[MAC].lic
Then I added a bat task to jenkins, and ran the job:
You should see something like:
Trying to checkout IAEE version=12.0
InstallAnywhere is successfully registered.

Resources