简体   繁体   English

Team Foundation Server自动构建

[英]Team foundation server auto build

We have a large non Visual Studio C++ project which is build via a batch file. 我们有一个很大的非Visual Studio C ++项目,它是通过批处理文件构建的。 I have integrated this up in Visual Studio as a makefile project with customised 'Build Command Line' in the project properties, this works well and has done for over a year. 我已经将其集成到Visual Studio中作为makefile项目,并在项目属性中使用了自定义的“ Build Command Line”,此方法运行良好,已经完成了一年多。

I am now looking to introduce Team Foundation Server and configure automated builds. 我现在希望介绍Team Foundation Server并配置自动构建。

If I build the project in Visual Studio then the project build as normal. 如果我在Visual Studio中构建项目,则该项目将正常构建。
If I use the automated build sever to build the project the build fails every time 如果我使用自动构建服务器来构建项目,则每次构建都会失败

The option to view the log file in the build report is greyed out. 在生成报告中查看日志文件的选项显示为灰色。 The report given is 给出的报告是

The command "Autobuild.cmd" exited with code 1. 命令“ Autobuild.cmd”以代码1退出。

Where autobuild is the cmd file specified in the solution's 'Build Command Line'. 自动构建是在解决方案的“构建命令行”中指定的cmd文件。

Can anyone think of a reason why this might be the case, I assumed that the build sever would just run the Build command with the project specified in the 'Items to Build' box. 谁能想到可能是这种情况的原因,我以为构建服务器将仅对“要构建的项目”框中指定的项目运行Build命令。 If this is the case then I cannot see why it would fail. 如果是这种情况,那么我将看不到为什么会失败。

There are loads of possible reasons; 有很多可能的原因。 unfortunately you've not given enough information to answer that questions. 不幸的是,您没有提供足够的信息来回答这些问题。

The first thing to try is changing your build definition logging level to Diagnostic . 首先尝试将构建定义日志记录级别更改为Diagnostic (you can also do this when you queue a new build). (您也可以在排队新版本时执行此操作)。

What I also recommend is actually wrapping your makefile in an msbuild.proj file. 我还建议实际上将您的makefile包装在msbuild.proj文件中。

Something simple like: 很简单的东西:

<Project ToolsVersion="4.0" DefaultTargets="build"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="build">
    <Exec Command="autobuild.cmd" />
  </Target>
</Project>

The Exec task has loads of options to customize how the cmd is called and should help you diagnose your error. Exec任务包含许多选项,用于自定义cmd的调用方式,并应有助于您诊断错误。

In general if you want to take advantaged of TFS builds I'd recommend migrating as much of your autobuild.cmd to msbuild as possible. 通常,如果您想利用TFS生成,我建议尽可能多地将autobuild.cmd迁移到msbuild。 MSBuild is TFS's "makefile" language, so-to-speak. 可以说,MSBuild是TFS的“ makefile”语言。

In your build definition you have an option of logging, there you can change that to Verbose logging. 在构建定义中,您可以选择记录日志,您可以将其更改为“ Verbose记录”。 Maybe you get some information in your log file then. 也许您随后在日志文件中获得了一些信息。

And for the issue of exited with code 1 I think you will need to add some extra informational lines to be printed in the cmd program and when your logging in TFS Build is active you maybe see more information on it. 对于代码1退出的问题,我认为您将需要添加一些额外的信息行以在cmd程序中打印,并且在登录TFS Build处于活动状态时,您可能会看到关于它的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM