TFS后生成步骤运行应用程序挂起 [英] Tfs post-build step running application hangs

查看:238
本文介绍了TFS后生成步骤运行应用程序挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有这使我们建立一个配置的TFS CI。之后构建I`d喜欢有我的简单的可执行应用程序部署到特定的文件夹在服务器上,然后启动。

We have a configured TFS CI which is making our build. After a build I`d like to have my simple executable application to be deployed to specific folder on the server and then started.

我决定生成后步骤和批处理脚本来做到这一点。一切完美,除了:

I decided to do this with post-build step and batch script. Everything works perfectly except one:

在申请的时候瞪大了眼睛,建立代理挂起(谁运行我的脚本中的一个)。

when the application is stared, build agent(the one who runs my script) hangs.

下面是如何,我开始从脚本我的应用程序:

Here is how I start my application from the script:

start /b %depldir%\MyApp.exe [params] > log.txt

所以我开始它backgroound和重定向STD输出/错误到文件。

So I start it in backgroound and redirect std out/error to file.

应用程序正常启动,但建设过程那倒完成,直到我杀了应用程序。

Application is started correctly but build process won`t finish untill I kill the application.

我该如何开始我的应用程序,而生成代理等待它完成?

How do I start my application without build agent waiting for it to finish?

推荐答案

我不知道这是否是一个错误,但如果你使用启动/ B&东西GT; LOGFILE.TXT 新藏cmd窗口启动与参数 / K 。这迫使隐藏的窗口保持活跃。这使得调用蝙蝠等待它退出,这就是为什么您的构建将不会终止。为了验证这一点,我创建了两个文件:

I'm not sure if this is a bug but if you use start /b something > logfile.txt the new and hidden cmd window is started with parameter /k. This forces the hidden window to stay active. This makes the calling bat wait for it to exit and this is why your build won't terminate. To verify this I've created two files:

starter.bat:

starter.bat:

start /b tostart.bat > log.txt

tostart.bat:

tostart.bat:

echo started

当我开始starter.bat的CMD不会终止,并在任务管理器中会出现以下过程:

When I start starter.bat the cmd doesn't terminate and in the task manager the following process appears:

cmd.exe的用户00日00:00:00 1.400k C:\\ WINDOWS \\ SYSTEM32 \\ CMD.EXE / K
   tostart.bat

cmd.exe USER 00 00:00:00 1.400k C:\Windows\system32\cmd.exe /K tostart.bat

/ K的意思是:

/ K运行命令,然后返回到CMD提示。
            这是非常有用的测试,检查变量(从 http://ss64.com/nt/cmd.html采取

/K Run Command and then return to the CMD prompt. This is useful for testing, to examine variables (taken from http://ss64.com/nt/cmd.html)

为了削减长话短说:当您更换正常工作启动/ B 呼叫 。不幸的是呼叫没有像/ B让你的应用程序将无法在后台启动参数。我不知道这是否对你是一个问题。

To cut a long story short: it works fine when you replace start /b with call. Unfortunately call doesn't have a parameter like /b so your application won't start in background. I don't know whether this is a problem for you.

如果它是:我已经遇到了类似的问题,我的詹金斯构建服务器。我的解决方案是创建它运行我的应用程序(在后台)的任务。而不是调用程序本身我只是叫中的schtasks /运行/ TNTASK_NAME。这个命令只是触发任务,而无需等待。这种方式,您也可避免与权限问题等。

If it is: I've faced similar problems with my Jenkins build server. My solution was to create a task which runs my application (in background). Instead of calling the program itself I just call SCHTASKS /Run /TN "TASK_NAME". This command just triggers the task without waiting. This way you can also avoid problems with permissions etc.

这篇关于TFS后生成步骤运行应用程序挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆