Run powershell command as a background - tfs

I need to trigger TFS build run command as a background process. How can i do it in Powershell? I have tried to use Start-Job command but it does not work. Need your help.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TFSBuild.exe start /collection:"https://test.tfs.siemens.net/test" /builddefinition:"Test\Test.build"

Use start-process command to launch the script. This will make sure that the launched job keeps running when the task is finished. But the job will be closed when the build is finished.
Start-Process powershell.exe -ArgumentList '-file xxxx.ps1'

Related

Build/deploy Vue.js project through Jenkins

I am new to Jenkins but have done a few builds/deployment jobs of .net project successfully.
Now I am trying to build/deploy Vue.js project through Jenkins but just cannot get through...
I can build the project directly on a server using command prompt. It builds and creates files for deployment in a right directory.
When I am trying to do it in Jenkins job (using the same npm commands) it does not give any error messages, says it built successfully but it does NOT create any files for deployment.
Does anybody encounter this problem? Did anybody build Vue js project through Jenkins? Any help appreciated. Thanks!
In execute windows batch command I run:
cd myworkdirectory
npm install
npm run build
Not too complex, as I found.
Create freestyle project.
In section Source Code Management please define your repository.
In section Build Triggers please define triggers
In section Build define either Execute Windows batch command or Execute shell within sections like (my choice in the moment - windows):
git checkout develop
npm -g install
npm run build
del /s /f /q c:\applications\frontend-app-build\*.*
for /f %%f in ('dir /ad /b c:\applications\frontend-app-build\') do rd /s /q c:\applications\frontend-app-build\%%f
robocopy dist c:\applications\frontend-app-build\ /E

How to tell powershell not execute net command until the Exe installation finished?

I am new to powershell.
How to tell powershell not execute next command until the exe installation finished ?
Tried below two commands but dint help.
1. Start-Process -NoNewWindow -Wait
2. ./example.exe -NoNewWindow -Wait
Duplicate of:
How to tell PowerShell to wait for each command to end before starting the next?
Start-Process -wait doesn't work when script is launched from command prompt opened with runas or as a scheduled task
Run an application with PowerShell and wait until it is finished
Shop around next time before you ask, try any of these and consider deleting your question if any resolve your issue

codewarrior IDE is not responding back when build runs from jenkins

I m trying to build a project from codewarrior IDE command line. It works fine when i run it manually on the windows slave as:
CmdIDE.exe C:\Jenkins\build\workspace\project_name\xxxxxxxx.mcp /b /c /q
But when i try to run the build from Jenkins nothing happens and it keeps on running. I tried to do this from a batch script using psexec but still no response. Please help if anyone has done this from jenkins.
C:\Program Files\Freescale\CodeWarrior for Microcontrollers V6.3\bin>CmdIDE.exe 'C:\project_name\xxxxxxxx.mcp' /b /c /q
Freescale CodeWarrior IDE. Hit /? for help ERROR: Process Aborted. (Code 9)
C:\Program Files\Freescale\CodeWarrior for Microcontrollers V6.3\bin>exit 9 Build step 'Execute Windows batch command' marked build as failure
Thanks in advance

devenv.exe execute through jenkin's job doesn't work

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

Jenkins - Cannot proceed with MSBuild

I have worked almost one day with Jenkins to setup for automation publishing an ASP.NET web application. I have got it done in one local virtual machine, but it did not work when I tried with an production server.
Could any one can help or advise me? Here is the console error output:
......
no change for **SVNpath**1 since the previous build
Path To MSBuild.exe: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
Executing command: cmd.exe /C C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe /t:rebuild D:\JenkinsInstall\jobs\ADDevelopmentPublishing\workspace\Web\ABC\ABC.csproj && exit %%ERRORLEVEL%%
[workspace] $ cmd.exe /C C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe /t:rebuild D:\JenkinsInstall\jobs\ADDevelopmentPublishing\workspace\Web\ABC\ABC.csproj && exit %%ERRORLEVEL%%
The command prompt has been disabled by your administrator.
Press any key to continue . . .
Build step 'Build a Visual Studio project or solution using MSBuild.' marked build as failure
Finished: FAILURE
------------------
Many Thanks
this line:
The command prompt has been disabled by your administrator indicates that you are not allowed to launch batch instructions on your server.

Resources