如何在TeamCity中构建Delphi项目 [英] How to build a Delphi project in TeamCity

查看:87
本文介绍了如何在TeamCity中构建Delphi项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在TeamCity中构建一个delphi项目,但无法使其正常工作.

I am trying to build a delphi project in TeamCity, but I can't get it to work.

我正在使用MSBuild来构建项目,并且还向构建中添加了BDS参数,但我不断收到错误消息:MSB4040项目中没有目标.

I'm using MSBuild to build the project and also have added BDS parameter to the build but I keep getting the error: MSB4040 There is no target in the project.

推荐答案

您需要注意几件事.首先,需要设置Delphi所需的各种环境变量和路径.这大部分是通过rsvars.bat批处理文件完成的,但是您可以设置自己的文件.其次,需要正确设置EnvOptions.proj文件以匹配构建计算机上的环境.该文件位于%APPDATA%\ Embarcadero \ xx,x \中,其中xx.x是您的Delphi版本.

There are several things you need to be aware of. Firstly, the various environment variables and paths that Delphi requires need to be setup. Much of this is accomplished by the rsvars.bat batch file, but you can set up your own. Secondly, your EnvOptions.proj file needs to be set correctly to match the environment on your build machine. This file resides in %APPDATA%\Embarcadero\xx,x\ where xx.x is your Delphi version.

以下带有注释的CMD文件是我用来在TFS环境中构建Delphi XE7应用程序的文件,应与TeamCity和其他构建工具一起使用:-

The following commented CMD file is one that I use to build Delphi XE7 applications in a TFS environment and should work with TeamCity and other build tools :-


@echo off
:::
::: Example for Build Delphi Project with MSBuild
:::

echo.
echo using MSBuild from VStudio 2013
echo.
SET MSBUILD_EXE=C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe

echo.
echo A copy of a Delphi installation from a developers machine is ok. MSBuild calls dcc32/dcc64, not the IDE.
echo The build targets are included in "$(DelphiInstallDir)\bin\CodeGear.Delphi.Targets".
echo DefaultTarget is "Make"
echo.

echo.
echo Set Delphi XE7 Vars
echo.

SET BDS=C:\DelphiXE7
SET BDSBIN=%BDS%\bin
SET BDSLIB=%BDS%\lib
SET BDSTMP=%BDS%\Temp

echo.
echo On a local Delphi developer machine the actual used Delphi settings are located here: 
echo "%APPDATA%\Embarcadero\BDS\15.0\EnvOptions.proj"
echo.
echo The directories and files included in "EnvOptions.proj" must exist on the build machine!!!
echo.
echo Copy the (maybe modified) Delphi settings on your build machine to %APPDATA%\Embarcadero\BDS\15.0
echo.
MKDIR "%APPDATA%\Embarcadero\BDS\15.0"
COPY /Y /B /V "%BDSTMP%\EnvOptions.proj" "%APPDATA%\Embarcadero\BDS\15.0\EnvOptions.proj"

echo.
echo Set the Delphi Project Vars
echo.
SET PROJECT_SRC=C:\MyProjectSource
SET PLATFORM=Win32
SET CONFIG=Debug

echo.
echo Build Delphi Project with MSBuild 
echo.
echo + /p = Parameters for the Delphi Project Build
echo.
echo + /t = Targets to be executed, e.g. Clean and Build 
echo.
"%MSBUILD_EXE%" "%PROJECT_SRC%\myProject\myProject1.dproj" /p:Config=%CONFIG%;Platform=%PLATFORM% /t:Clean;Build

IF NOT ERRORLEVEL 0 GOTO ERROR

GOTO END

:ERROR
echo.
echo There were errors!
echo.
pause
EXIT

:END
pause

这篇关于如何在TeamCity中构建Delphi项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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