I am using Visual studio and TeamCity tools. I have added project in TeamCity. When TeamCity project build succeeded, TeamCity automatically should commit new binaries from bin/Release folder to specifed SVN path(e.g svn:\abc.com\root\trunk ). Does any one know how can I achieve this? Please let me know the steps. Thanks in advance.
-
6Do you really want to store such kind of binary in SVN? I don't think it is a good idea. Anyway, I believe in Teamcity you can run shell scripts and you can just do whatever you want (svn import etc) after the build is complete – Adrian Shum Sep 27 '12 at 10:12
-
Could you please share the working solution @manoj jaiswal ?? – programoholic Feb 12 '18 at 18:18
3 Answers
Add Command Line
build step to your TC configuration, just after the primary build step, containing command commit_build.bat
. Create a commit_build.bat
file that will commit your artifacts to SVN with the standard svn commands.
Don't forget to commit commit_build.bat
into the repo.

- 24,894
- 13
- 106
- 174
-
Thanks... I am beginner to TeamCity. Could you please elaborate this into detailed steps? – Manoj Jaiwal Sep 28 '12 at 09:35
-
Thanks for the solution. I have created a batch file and ran it through TeamCity. It was successful. I am confused where & why shall have to commit batch file. – Manoj Jaiwal Sep 28 '12 at 11:43
-
You have to commit it anywhere into the repository (i.e. in your repository root folder) so every build agent can find and run it. – Sergey K. Sep 28 '12 at 12:08
Our build process includes a "Tag" MsBuild step after the building and unit testing steps are completed. this step cleans up any extra files from the build (e.g. unnecessary external dependencies if you are building a project to be referenced elsewhere) and commits the binaries. this is simply an MsBuild step which runs an MsBuild script tagging the built projects.
you can obtain the list of DLLs the project builds using the TargetOutputs element of the MsBuild call in your script, for example:
<MSBuild Projects="yourSolutions" Targets="Rebuild" Properties="Configuration=Release;Platform=x86">
<Output ItemName="BinaryOutputs" TaskParameter="TargetOutputs"/>
</MSBuild>
you can then use standard svn commands to commit your files.

- 1,445
- 14
- 15
Here is what we used in our CI--Can handle most cases for auto compiling binaries and auto resource packaging:
:Deleting all missing files
for /f "usebackq tokens=2*" %%%%i in (`svn st ^| findstr /R "^!"`) do svn del "%%%%i@"
:Add all valid files
for /f "usebackq tokens=2*" %%%%i in (`svn st ^| findstr /R "^?"`) do svn add "%%%%i@"
:This line is needed, otherwise svn may result in "outdated"
svn up --accept working .
:Final commit
svn commit . --non-interactive --no-auth-cache --trust-server-cert -m "Some comment: %build.counter%"
You can use all the upper lines in one task or separate each of them into tasks, which is better.
You may need to find out what's actually doing by reading the documents, and altering the lines on your own auto-commit as a customized task.

- 237
- 3
- 6