TeamCity删除构建上的文件 [英] TeamCity deletes files on build
问题描述
我是TeamCity和持续集成的新手。我已遵循这个非常好的指南设置一切,所有这一切似乎一开始工作。
TC可以检出文件从SVN和它可以构建他们没有问题。但是我发现'Checkout目录'设置是错误的,它指向一个文件夹之上,因此它应该是因此添加所有新文件从SVN在错误的地方,但仍旧建立在旧的。
现在每次TC做一个构建,它会清除'Checkout目录'中的所有文件,这个问题是,并不是所有需要的文件由SVN管理,他们被永久删除。由于并非所有必要的文件都存在,所以构建失败。
我应该怎么做使TC保存我的文件?
来自TC的设置如果可以帮助:
常规设置编辑»
名称:Mavia Build
说明:无
Build number format:{0},next build number:#8
工件路径:无指定
失败建立if:
流程退出代码不为零:ON
至少一个测试失败:ON
生成程序记录错误消息:OFF
运行时间超过:无限制
检测到内存不足或崩溃:ON
构建选项:
悬挂建筑检测:ON
最多同时运行的版本数量:无限制
版本控制设置编辑»
VCS检出模式:服务器上自动启动
结帐目录:C:\Inetpub\wwwroot\mavia_sip
在生成之前清理所有文件:OFF
VCS标签:已停用
附加的VCS根:
mavia_sip svn未指定NO
赛跑者:sln2008编辑»
转轮类型:sln2008(Microsoft Visual Studio 2008解决方案文件的Runner)
解决方案文件路径:mavia_sip\WebSite\mavia_sip.sln
工作目录:与结帐目录相同
目标:重建
$ b b配置:调试
解决方案平台:默认
NUnit运行平台: / p>
NUnit runner:NUnit 2.2.10
运行测试从未指定
不要运行测试:无指定
NUnit类别包括:无指定
NUnit类别exclude:无指定
减少测试失败反馈时间:OFF
MSTest:disabled
XML报表处理:已停用
建立触发编辑»
触发建立vcs check-in:ON
按时间触发:
未配置
此配置取决于:未配置
依赖关系编辑»
快照依赖关系:
没有快照依赖关系。
/ p>
没有工件依赖项。
属性和环境变量编辑»
系统属性:无定义
环境变量:无定义
代理需求编辑»
系统属性的要求:无定义
环境变量的要求:未定义
好的,这是我怎么做的:
首先,我让TC签出并在网站上单独的文件夹中构建项目。需要的外部dll从bin文件夹移动到一个单独的文件夹,并添加到subversion(也更新Visual Studio中的引用)。
第二,我在Visual Studio中创建了一个Post Build Script,如下所示:
xcopyC:\TeamCityBuild\mavia_sip\WebSite\ *C:\Inetpub\wwwroot\mavia_sip\WebSite\/ C / R / Y / E
如果errorlevel 1退出0
错误处理只需要避免脚本有人在没有正确文件夹结构的环境中构建项目时出现错误。
到目前为止,everyting工作正常!
I am a newbie to TeamCity and Continuous Integration. I have followed this very nice guide to set everything up and it all seemed to work at first.
TC could check out the files from SVN and it could build them with no problems. However I discovered that the 'Checkout directory'-setting was wrong, it pointed one folder above where it should be hence adding all new files from SVN in the wrong place but still building on the old ones. After correcting this the problems started.
Now every time TC does a build it cleares all files in the 'Checkout directory' the problem with this is that not all files needed are managed by SVN and they are deleted forever. Since not all necessary files are there the build fails.
What should I do to make TC keep my files?
Settings from TC if it could help:
General settings edit »
Name: Mavia Build
Description: none
Build number format: {0}, next build number: #8
Artifact paths: none specifed
Fail build if:
process exit code is not zero: ON
at least one test failed: ON
an error message is logged by build runner: OFF
it runs longer than: no limit
out of memory or crash is detected: ON
Build options:
hanging builds detection: ON
status widget: OFF
maximum number of simultaneously running builds: unlimited
Version control settings edit »
VCS checkout mode: Automatically on server
Checkout directory: C:\Inetpub\wwwroot\mavia_sip
Clean all files before build: OFF
VCS labeling: disabled
Attached VCS roots:
Name Checkout rules Set label
mavia_sip svn not specified NO
Runner: sln2008 edit »
Type of runner: sln2008 (Runner for Microsoft Visual Studio 2008 solution files)
Solution file path: mavia_sip\WebSite\mavia_sip.sln
Working directory: same as checkout directory
Targets: Rebuild
Configuration: Debug
Solution Platform: default
NUnit Run platform: auto(MSIL)
NUnit runner: NUnit 2.2.10
Run tests from: none specified
Do not run tests from: none specified
NUnit categories include: none specified
NUnit categories exclude: none specified
Reduce test failure feedback time: OFF
MSTest: disabled
XML report processing: disabled
Build triggering edit »
Build configuration is paused (triggering disabled).
Trigger build by vcs check-in: ON
Quiet period: default, 60 seconds
Start new build if last build is failed: OFF
Triggering by time: not configured
This configuration depends on: not configured
Dependencies edit »
Snapshot Dependencies:
There are no snapshot dependencies.
Artifact dependencies:
There are no artifact dependencies.
Properties and environment variables edit »
System properties: none defined
Environment variables: none defined
Agent requirements edit »
Requirements for system properties: none defined
Requirements for environment variables: none defined
Ok this is how I did it:
First I let TC check out and build the project in a separate folder on the site. The external dll's that were needed were moved from the 'bin'-folder to a separate folder and added to subversion (also updating the referenses in Visual Studio).
Now TC could build the project with no hassle.
Second I created a Post Build Script in Visual Studio like this:
xcopy "C:\TeamCityBuild\mavia_sip\WebSite\*" "C:\Inetpub\wwwroot\mavia_sip\WebSite\" /C /R /Y /E
if errorlevel 1 exit 0
The error handling is only needed to avoid script errors when someone builds the project on a environment without the correct folder structure.
So far everyting is working great!
这篇关于TeamCity删除构建上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!