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
The checkout directory should not contain any files you care about!
You should definitely be able to do "clean builds", and have TeamCity delete everything in the folder.
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:
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!