How to check in the artifacts into tfs

I have a requirement that I must check in the artifacts from teamcity.

I have teamcity set up so that it gives me the correct files as artifacts.

But now I have to be able to take these files and check them in into TFS under a differant folder (under the main working directory).

So say I have:
     - binaries
     - projectfolder
     - solution file

I can get teamcity to build and take the needed files and publish them as artifacts but I also want to copy these artifacts and put them into the 'binaries' folder and check them in into TFS.

I'm using the latest version of teamcity.

Any help would be appriciated


Comment actions Permalink

Hi Tom

You can run this checkin command explicitly in additional command-line build step.

Please also check that your build configurations are configured to use agent-side checkout.


Comment actions Permalink

The problem I'm having at the moment is that I can't get to the artifacts path.

I'm sure there is a variable for it but I can't seem to find it.


My artifacts are located on: C:\TeamCity\BuildServer\system\artifacts\TestUnitPublishing\TestUnitPublishing\56\Binaries

Where as my checkout directory is: C:\TeamCity\TeamCity\buildAgent\work\f7489a7f0e67b2d9\Binaries

(the server is currently installed on my local machine for testing)

So I need to get the artifacts into the checkout directory otherwise TFS doesn't want to check them in.

If I can get to the artifacts from within a command line build step and can copy them to the checkout dir I can start to look into checking them into TFS

Any help with this will be appricated

Comment actions Permalink


Your build scripts should not access files inside TeamCity data directory at C:\TeamCity.
Now the build is executed on the same machine as TeamCity web server is installed, but laterwhen you add new build agents on other computers, it will stop to work.

It's better to keep build scripts isolated and portable. The artifact files are created within checkout directory, so you can use relative paths to access them.

Comment actions Permalink

I know and currently I'm not using the artifacts at all because of that.

Maybe if I explained the current setup (that does work but is far from perfect I think) it might be a bit clearer.

General settings:
- artifacts paths:
     TestUnitPublishing\bin\release\*.exe => Binaries
     TestUnitPublishing.Tests\bin\release\TestUnitPublishing.Tests.dll => Binaries

Version control settings:
- vcs checkout mode: automatically on agent
- checkout directory: auto

Build steps (7) (step 1-4 aren't the problem I think)
- build solution (basic visual studio build)
- ms tests
- nunit tests
- inspections (.net)
- command line step to checkout the files from tfs (needed otherwise I can't check them in (permissions and such))
     d:\software\tf\tf.exe get\Binaries /recursive
     if EXIST\Binaries\TestUnitPublishing.exe (d:\software\tf\tf.exe checkout\Binaries /recursive)
- copy artifacts step (here is where I can't access the artifacts so I just do a copy of the build output in my release folder)
     Copy\TestUnitPublishing.Tests\bin\Release\TestUnitPublishing.exe\Binaries /Y
     Copy\TestUnitPublishing.Tests\bin\Release\TestUnitPublishing.Tests.dll\Binaries /Y
- checkin from binaries
     d:\software\tf\tf.exe add\binaries\TestUnitPublishing.exe
     d:\software\tf\tf.exe add\binaries\TestUnitPublishing.Tests.dll
     d:\software\tf\tf.exe checkin /force /noprompt

When I go and look at my local system the artifacts aren't anywhere to be found in the checkout directory.
I assume that the directory under buildagent is my checkout directory:

But I can find them under the buildserver directory:

As I said I got it working but I find a bit counterproductive since now if I have a new dll or any other artifact I have to change the configuration at 2 stages (under general settings the artifacts paths and in my build step so it gets copied to the correct folder for checkin)
I'd much prefer that I can change the copy artifacts step to just copy all the artifacts to that binaries folder.

Unless there is a other way to do this, I'm new to teamcity so I might have overlooked some setting that would make it all easyer.

Comment actions Permalink


Sorry for the delay in replying.

OK, so the issue seems to be that you want to configure artifact patterns in a single place and then use them for defining TeamCity artifacts and inside the build script to check the files into TFS.

I can think of the following options:
- store artifacts definition in a TeamCity system property, reference it in the artifact patterns field (with syntax), get the property in the build script and use it there, or
- store the patterns in the build script, prepare artifacts in a directory, check them into TFS, make TeamCity publish artifacts from the same directory with a simple "publish all from the directory" pattern, or
- move the artifact checkin into TFS into a separate build configuration, which will artifacgt- and snapshot-depend on the one producing artifacts. Trigger this publishing build configuration instead of the one producing artifacts.


Please sign in to leave a comment.